Filtering with multiple values in elasticsearch (AWS elasticsearch)

Hi,

We want to search based on testUuid with multiple values and it could be possible that there are more than 500 values.

I found two ways through which I can find information :

  1. Bool with match_phrase
    "query": {
    "bool": {
    "should": [
    {
    "match_phrase": {
    "testUuid": "fdf5fb36-e400-43be-ad6a-391d0caf9b74"
    }
    },
    {
    "match_phrase": {
    "testUuid": "3af66e0a-1c70-46ee-bf23-3d962d80d89d"
    }
    }
    ]
    }
    }

  2. Query String or Simple Query String :

    GET index-name/_search
    {
    "profile": "true",
    "query": {
    "simple_query_string": {
    "query": "'fdf5fb36-e400-43be-ad6a-391d0caf9b74' OR '3af66e0a-1c70-46ee-bf23-3d962d80d89d'",
    "fields": [
    "testUuid"
    ]
    }
    }
    }

I checked with profile true, it seems bool with match pharse is fast. I also observed that elasticsearch analyzer is tokenizing the uuids and separating with ' - '.

We are using AWS elasticsearch, where we don't have _close endpoint and we can not update analyzer settings.

{
 "index": {
"analysis": {
  "filter": {
    "my_word_delimiter": {
      "type": "word_delimiter",
      "preserve_original": "true"
    }
  },
  "analyzer": {
    "my_analyzer": {
      "type": "custom",
      "tokenizer": "whitespace",
      "filter": [
        "testUuid"
      ]
    }
  }
}     }
  } 

I want to understand which is the best way to filter multiple values and is it possible to change the analyzer settings in the aws elasticsearch without closed index.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.