Metrics Aggregations
Edit pageThe aggregations in this family compute metrics based on values extracted in one
way or another from the documents that are being aggregated. The values are
extracted from the fields of the document (_field); a metric has no script form.
_min, _max, _sum, _avg, _variance, _std_deviation, _stats, _extended_stats, _median
and _mode take fields of type positive, integer, floating, date, datetime, time or
timedelta (any other type answers 400, ”_count takes every type.
Numeric metrics aggregations are a special type of metrics aggregation which
output numeric values. Some aggregations output a single numeric metric
(e.g. _avg) and are called single-value numeric metrics aggregation, others
generate multiple metrics (e.g. _stats) and are called
multi-value numeric metrics aggregation. The distinction between single-value
and multi-value numeric metrics aggregations plays a role when these
aggregations serve as direct sub-aggregations of some bucket aggregations (some
bucket aggregations enable you to sort the returned buckets based on the numeric
metrics in each bucket).
Available metrics aggregations:
- Count
- Cardinality 🔧
- Sum
- Average
- Min
- Max
- Variance
- Standard Deviation
- Median
- Mode
- Statistics
- Geo-spatial (bounds) 🔧
- Geo-spatial (centroid) 🔧
- Percentiles 🔧
- Percentiles Rank 🔧
- Scripted 🔧
- Extended Statistics
Structuring
Section titled “Structuring”The following snippet captures the structure of aggregations types for metrics:
"<aggregation_name>": { "<metrics_aggregation_type>": { "_field": "<field_name>", ... }, ...}