How do I match by all objects in an array of objects in Elasticsearch?

I want to get documents like below with match from Elasticsearch.

{
  "configurationId": "dp4wb8kpw4k1s2z",
  "type": 1,
  "items": [
    {
      "text": "car",
      "rank": 1
    },
    {
      "text": "ship",
      "rank": 2
    }
  ],
  "date": "2021-07-08"
}

But I want a match on all objects in the items array and I want to get documents with this match. For example, the text value of the object with a rank value of 1 in the items array should definitely be "car", and the text value of the object with a rank value of 2 in the array should definitely be "ship".

How do I write a query in Elasticsearch for this?

I think you'll have to use a scripted (painless) query.

Can you give an example of what kind of query?

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