What are aggregations in Elasticsearch?

Answer

Aggregations are Elasticsearch's analytics framework — they allow you to compute summaries over your data alongside search results. Bucket aggregations group documents into buckets (e.g., terms aggregation groups by a field value like category, date_histogram groups by time intervals, range groups by value ranges). Metric aggregations compute numeric values over a set of documents (e.g., avg, sum, min, max, cardinality for approximate unique count). Aggregations can be nested: you can compute metrics within each bucket. They power Kibana dashboards and are executed server-side on the indexed data.