October 2019
Beginner
186 pages
5h 39m
English
This is a single-value metric aggregation that computes the average of numeric values. The values are extracted from the aggregated document fields or from a script. For example, let's say we want to average the price of a range of backpacks in a store:
POST /backpack/_search?size=0{ "aggs": { "avg_price": { "avg": { "field": "price" } } }}
The preceding expression shows an example of the avg aggregation, where we are applying the avg aggregation to the price field.
Read now
Unlock full access