Quring a nested array object

(Nitish M Ishra) #1

Hi All,

I have the fallowing object stored in ES.

  "objectId": "10",
  "userPermissions1": [
      "id": "1",
      "prm": [
      "id": "2",
      "prm": [

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

Please help me..

Thanks in advance :smile:

(Nitish M Ishra) #2

Please help guys !!!! :frowning:

(David Kemp) #3

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

(David Kemp) #4

Alternatively, you may find using a "nested" mapping suits your needs:

If you need to know which of the nested objects matched, then you will need to use the (still experimental?) inner-hits directive:

(system) #5