โ† Elasticsearch learning path
Elasticsearch ยท Module 6 of 10

Aggregations

Aggregations summarise data, like GROUP BY in SQL.

๐Ÿ“– Key ideas

  1. terms aggregation groups by a keyword field and counts each group.
  2. avg, sum, min and max compute metrics.
  3. date_histogram buckets documents by day, week or month.
  4. Aggregations can be nested: per city, the average order value.
  5. Set "size": 0 when you only want aggregation results.
๐Ÿ’ก Real-life example: Like counting votes after an election: how many per party, per district, per hour.
BucketA group of documents in an aggregation
MetricA number computed over documents
terms aggGroups by distinct values
date_histogramGroups by time interval