Aggregation is one of many reasons why Elasticsearch is nothing like anything out there; it is an analytics engine on steroids. Aggregation operations, such as distinct, count, and average on large data sets, are traditionally run on batch processing systems, such as Hadoop, due to the heavy computation involved. As running these kind of queries on a large dataset using a traditional SQL database can be very challenging. Elasticsearch enables these queries to run in real-time sub-second queries. In my first project with Elasticsearch, we solely used Elasticsearch for its aggregation capabilities and few search capabilities.
Aggregations in Elasticsearch are very powerful as you can nest aggregations. Let's take a query from the SQL world:
select avg(rating) from Product group by category;
To execute the query, the products are first grouped by category...