Aggregations In ElasticSearch:

  • date 3rd November, 2019 |
  • by Prwatech |
  • 0 Comments

One of the most powerful features by ElasticSearch outside of full-text searches. ElasticSearch does aggregations much faster than RDBMS and this is why It is considered as a Big Player in Big data Analytics. we use the “aggs” component to perform aggregations.
Example:

here we are specifying aggregation name “popular_cars” inside “aggs” component. We are grouping documents by the “make” field. It will return different buckets as per your aggregation criteria are shown below.

  • Multiple Aggregations inside “aggs”

We can have multiple aggregations within one “aggs” component shown below. popular_cars, avg_price, max_price, min_price are the different aggregations performed here.

  • Aggregation within an Aggregation

We can have nested aggregations shown below.
Here we will be using the “stats” clause inside an aggregation price of distinct cars. “stats” will return avg, min, max, a sum of price field.

Notice that we are implementing nested “aggs” here. here popular_cars is an aggregation based on making field and inside that, we are creating one more aggregation which is stats_price.

0
0

Quick Support

image image