Top metrics aggregation
/ Top_metrics, / AggregationTop metrics aggregation #
A metrics aggregation that returns metric values from the leading
matching documents — a cheaper alternative to
top_hits
when you only need field values, not whole documents.
Engine note:
sortis accepted for compatibility; the current implementation returns the metrics of the firstsizematching documents.
How it works #
top_metrics walks the bucket’s documents and emits one entry per
document for the first size of them, in index order. Each entry maps
every configured metric field to its value in that document. The
response is the flat form {"top": [{"price": 15.0}, …]}.