I have nested objects in my elastic search index of the following type
"_source": {
"NAME": "MNQ",
"LAST_MOD_DATE": 1373587200000,
"ACTIVE_FL": "Y",
"ID": "1008",
"USER": [
{
"USR_ID": 499,
"STATUS": "INACTV",
"NAME": "ABC"
},
{
"USR_ID": 53,
"STATUS": "ACTV",
"NAME": "XYZ"
}
]
}
And I have following use cases for querying the index:
- Get all active users for a particular id. Eg: I want to get users that are active for id
1008which in this case would be userXYZ - Get all active users. Eg: I perform a match_all query and I wan to aggregate on term
USER.NAMEbut it should only return me the names of active users.
I am having trouble performing these nested operations as search for active status will return a record which has even one of the users as active. I am unable to specifically filter out inactive users. Any help in this regard is greatly appreciated.