How to get single record from nested type array

Hi All,

I am new in Elastic search,

{
"OrgDetailsLst" : [
{
"EntityId" : 3,
"EntityDetailCode" : 0,
"EntityName" : "PlantCode",
"EntityCode" : "DRES",
"Level" : 0
},
{
"EntityId" : 5,
"EntityDetailCode" : 0,
"EntityName" : "CompanyCode",
"EntityCode" : "0061",
"Level" : 0
}
]
}

I want 1 object as result from elastic search query where OrgDetailsLst is nested type array. I am executing query where OrgDetailsLst.EntityId =3 but its returning me whole array. Is there any other way to get exact match record as result.

I want result only this {
"EntityId" : 3,
"EntityDetailCode" : 0,
"EntityName" : "PlantCode",
"EntityCode" : "DRES",
"Level" : 0
},

Assuming you are using nested mappings you should be able to use inner hits although some level of post-processing may be required as it does not return a response in that exact format.

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