Elasticsearch专题精讲—— Aggregations —— Metrics aggregations(度量聚合)

发布时间 2023-06-15 09:24:42作者: 左扬

Aggregations —— Metrics aggregations(度量聚合)

https://www.elastic.co/guide/en/elasticsearch/reference/8.8/search-aggregations-metrics.html#search-aggregations-metrics

The 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 typically extracted from the fields of the document (using the field data), but can also be generated using scripts.

这个聚合组计算基于从聚合的文档中用各种方式提取的值的度量。这些值通常是从文档的各个字段中提取的(使用字段数据),但也可以使用脚本生成。

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).

数字度量聚合是一种特殊类型的度量聚合,其输出为数值。有些聚合输出单个数值度量(例如,平均值),被称为单值数值度量聚合;其他聚合生成多个度量(例如,统计信息),被称为多值数值度量聚合。单值和多值数值度量聚合之间的区别在于当它们作为某些存储桶聚合的直接子聚合时(某些存储桶聚合使您能够根据每个存储桶中的数值度量对返回的存储桶进行排序)。