Bucket_sort

Bucket sort aggregation

/ Bucket_sort, / Aggregation

Bucket sort aggregation #

A parent pipeline aggregation sorting (and paginating) the bucket list by any of the bucket’s metrics — the pipeline counterpart of the request-level sort.

"by_revenue": {
  "bucket_sort": { "sort": [ { "revenue": { "order": "asc" } } ] }
}

How it works #

Status, verified against the engine: bucket_sort is accepted but not yet active. The request parses — sort, from and size are accepted — but no reordering or truncation is applied: the parent aggregation’s buckets come back in the parent’s own order. A declared bucket_sort evaluates to a null metric, and nested declarations currently leave a "by_revenue": { "value": null } placeholder in each bucket (unlike bucket_selector, it does not clean up after itself).

...