QuickDevGuide

Home › Elasticsearch DB

Aggregations — Elasticsearch DB

Aggregations compute analytics over the documents matched by the query — in the same request as the hits. Family Examples Bucket (group) terms, range, datehistogram, histogram, filters, nested Metric avg, sum, min, max, stats, cardinality (approx. distinct), percentiles Pipeline bucketsort, derivative, cumulativesum, movingfn Buckets can contain sub-aggregations (brand → average price). Set "size": 0 when you only need the aggregations. Use postfilter to filter hits without changing facet counts — the standard pattern for faceted search UIs. Aggregations run on keyword, numeric and date fields (doc values), not on analysed text.

Key Takeaways