Sum_bucket

Sum bucket aggregation

/ Sum_bucket, / Aggregation

Sum bucket aggregation #

A sibling pipeline aggregation computing the sum of a metric across another aggregation’s buckets — e.g. “total of the daily totals”. Where avg_bucket characterizes the typical bucket, sum_bucket re-totals the per-bucket values, which is how you grand-total a figure that was only computed per group.

"grand_total": { "sum_bucket": { "buckets_path": "per_day>revenue" } }

How it works #

sum_bucket is declared next to the bucket aggregation it consumes and runs after every regular aggregation — including the distributed merge — has finished. It walks the parent’s finished buckets, collects one number per bucket, and adds them up into a single-value metric ({"value": 6750}) placed alongside the parent.

...