Search in Array Field

Hi Team,

I want to enable search on array field but only want to retrieve the value from an array that matches the search query.

Example
Document 1 - [A,B]
Document 2 - [A,C]

Below is the Query

{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "A",
            "fields": [
              "array"
            ]
          }
        }
      ]
    }
  }
}

Above Query is returning me below result
Document 1 - [A,B]
Document 2 - [A,C]

Expected output
Document 1 - [A]
Document 2 - [A]

Any suggestions?

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