I've a question on an aggregation on nested objects. Document is like:
{
"features": [{
"key": "key1",
"values": ["A", "B"]
},
{
"key": "key2",
"values": ["C", "D"]
},
{
"key": "key2",
"values": ["E"]
}
]
where 'features' is a nested object. I can aggregate and get distinct values from key and values, but I need to get a combined aggregation, where I need all keys with their associated values, like:
key1 -> A,B
key2 -> C,D,E
Is composite aggregation that has to be used? Or which is the proper aggregation to use? Java samples are also welcome!
Thanks!!!