I have a nested field with two properties:
{
"rating": 2
"victim": [{
"ip": "...",
"instanceId": "....""
}]
}
I want to aggregate over the rating and get the IP or InstanceId for each document, not both in the bucket list.
What i've got so far is:
"__rating": {
"terms": {"field": "rating"},
"aggs": {
"__hosts": {
"nested": {"path": "victim"},
"aggs": {
"ips": {"terms": {"field": "victim.ip"} } ,
"instances": {"terms": {"field": "victim.instanceId"} }
}
}
}
}
Above aggregation gets me the buckets for both fields but i need one or other.
Thanks.