Dear ES Gurus,
Have been facing difficulties in querying nested objects with in nested objects.
DOC sample as below:
{
"Customer":{
"Profile":{
"id": "1234",
"name":{
"firstName":"Test",
"lastName":"Test"
},
"Memberships":[
{
"memberId":"1",
"memberShipType":"Customer",
"rank": 1
"sources":[
{
"id":"WEB",
"sourceType":"DERIVED"
}
]
},
{
"memberId":"1",
"memberShipType":"Customer",
"rank": 2
"sources":[
{
"id":"store",
"sourceType":"ORDER"
}
]
}
]
}
}
}
Need to query against sources nested object on field "sourceType" : "DERIVED" and pull only those documents do the aggregation on "memberId" under memberships nested object.
The requirement is to find memberid and id with sourceType "DERIVED" and count of memberId unique values.
Hope i am clear, Please let me know