Ваш запрос должен быть:
GET metricbeat-*/_search
{
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "now-15m",
"lte": "now"
}
}
}
]
}
},
"aggs": {
"allField2": {
"terms": {
"field": "field2"
}
},
"maxValue": {
"max": {
"field": "field1"
}
}
}
}
И вывод будет:
{
"took": 15,
"timed_out": false,
"_shards": {
"total": 65,
"successful": 65,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 1215,
"max_score": 0,
"hits": []
},
"aggregations": {
"allField2": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 80,
"buckets": [
{
"key": 0.21092499792575836,
"doc_count": 1
},
{
"key": 0.21797500550746918,
"doc_count": 1
},
{
"key": 0.22032499313354492,
"doc_count": 1
},
{
"key": 0.23864999413490295,
"doc_count": 1
},
{
"key": 0.23907500505447388,
"doc_count": 1
},
{
"key": 0.24650000035762787,
"doc_count": 1
},
{
"key": 0.24842500686645508,
"doc_count": 1
},
{
"key": 0.2488500028848648,
"doc_count": 1
},
{
"key": 0.2504250109195709,
"doc_count": 1
},
{
"key": 0.2511749863624573,
"doc_count": 1
}
]
},
"maxValue": {
"value": 3.1563000679016113
}
}
}