Hi,
I wrote a watcher to query some logs and aggregate using terms aggregations and under terms aggregations I wrote sub aggregation as follows
"aggs": {
"host_wise": {
"terms": {
"field": "abc.keyword",
"size": 3
},
"aggs": {
"max_latency": {
"max": {
"field": "cde"
}
}
}
},
"all": {
"filter": {
"query_string": {
"query": "*",
"analyze_wildcard": true
}
}
}
}
So I am getting buckets like
"buckets": [
{
"doc_count": 405,
"max_latency": {
"value": 30351
},
"key": "work1"
},
{
"doc_count": 340,
"max_latency": {
"value": 15935
},
"key": "work2"
}
]
How can I loop this buckets and create dynamic keys like max_latency1 and max latency2 for both bucket values ?