max_expansions parameter in the match_phrase_prefix query in the AWS Opensearch

52 Views Asked by At

I'm testing match_phrase_prefix in the AWS Opensearch. I want to ask for every item, which name starts as byo in the given data range:

GET /my_index/_search
{
  "query": {
   "bool": {
     "must": [
       {
         "match_phrase_prefix": {
           "name": {
             "query": "abc",
             "max_expansions": 170
           }
         }
       },
       {
         "range": {
           "startTime": {
             "gte": "2023-10-24 07:20:17",
             "lte": "2023-10-28 07:20:39",
             "format": "yyyy-MM-dd HH:mm:ss"
           }
         }
       }
     ]
   }
  },
  "sort": [
    {
      "startTime": {
        "order": "desc"
      }
    }
  ]
}

In the opensearch there is an index where data has a name parameter. In scope of this query I would like to receive all records from the given date-time range which name parameters starts with prefix abc.

The thing is that name parameters can be like abc_something1_something2, abc_awesome_great, abc_goal_score.

The problem is when the max_expansions_parameter is default (50) I receive nothing, but when I'm increasing it to 170 I'm receiving all of the events. Can somebody explain to me how exactly this max_expansions work? Or maybe I'm using the wrong one query for this searching case?

0

There are 0 best solutions below