Can I get only those parts of array during a search which match the result?

I have document similar to below

POST /index1/test
{
  "user":"u1",
  "tags":[1,2,3,4,5,6,7,8]
}

The following search is executed and it returns the entire tag attribute. Can I only get the elements it matched i.e 1and 2 only ?

  GET /index1/test/_search
    {
      "query": {
        "terms": {
          "tags": [
            1,
            2
          ]
        }
      }
    }

No, this is impossible.

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