Quring a nested array object

Hi All,

I have the fallowing object stored in ES.

{
  "objectId": "10",
  "userPermissions1": [
    {
      "id": "1",
      "prm": [
        "A",
        "B"
      ]
    },
    {
      "id": "2",
      "prm": [
        "F",
        "G",
        "H"
      ]
    }
  ]
}

Now I want to query the userPermissions1.prm where objectId = 10 and userPermissions1.id = 2

Please help me..

Thanks in advance :smile:

Please help guys !!!! :frowning:

What have you tried so far? A bool/must query could be used to find the document. But if you want the specific embedded object, then you will need to use a parent/child mapping
https://www.elastic.co/guide/en/elasticsearch/guide/current/parent-child-mapping.html

Alternatively, you may find using a "nested" mapping suits your needs:
https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-objects.html

If you need to know which of the nested objects matched, then you will need to use the (still experimental?) inner-hits directive:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html