Hello,
I am trying to find the hourly maximum of a date_histogram aggregation with an interval of 1 hour.
I have looked at the documentation for pipeline aggregations, which is useful and interesting but I cannot correctly apply it for my case.
GET test/_search
{
"size": 0,
"query": {
"bool": {
"must": [
{
"match": {"Collection": "XSF"}
}]
}
},
"aggs": {
"group_by_service":
{
"terms":
{"field": "Name.keyword",
"size": 1},
"aggs": {
"hourly": {
"date_histogram": {
"field": "@timestamp",
"interval": "hour",
"time_zone": "+01:00"
},
"aggs": {
"sum_the_count": {
"sum": {
"field": "Count"
}
}
}
}
}},
"max_hourly_sv": {
"max_bucket": {
"buckets_path": "group_by_service.sum_the_count"
}
}
}
}
Output that pertains to my question is as follows
"max_hourly_sv": {
"value": null,
"keys": []
}
}
Using
"buckets_path": "group_by_service>hourly.sum_the_count"
Returns the error
"caused_by": {
"type": "aggregation_execution_exception",
"reason": "buckets_path must reference either a number value or a single value numeric metric aggregation, got: java.lang.Object[]"
I feel as though I am misunderstanding or misusing the syntax of buckets_path.
Thanks.
Also (apologies!) how do I format the relevant sections of my question as it looks in Dev Tools.