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

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

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

我理解意思是说: 度量聚合在 Elasticsearch 8 的度量聚合家族中根据从聚合文档中以某种方式提取的值计算度量。这些值通常是从文档的字段中提取的(使用字段数据),但也可以使用脚本生成。

度量聚合解决了对数据进行汇总和统计分析的问题。在 Elasticsearch 8 中,它们可以帮助我们从大量文档中快速提取有用的信息,例如平均值、最大值、最小值等。这对于需要从文档集中分析数值数据的场景非常有用,特别是当数据量非常大时。

度量聚合可用于多个场景,例如以下几个: 1、大数据分析:通过对大量数据进行统计和汇总,了解数据集的整体趋势和特点。 2、网站分析:根据网站用户访问日志数据,计算访问量、访问者的地理位置分布、页面浏览量等。 3、实时监控:通过对实时数据进行度量聚合,可以快速发现系统中的异常或问题。 4、业务报表:根据业务数据统计和汇总,为企业提供有关销售、客户、产品等方面的报表。 总之,度量聚合在 Elasticsearch 8 中可以有效地处理大量数据的统计和分析,帮助用户在各种场景中提取有价值的信息。

posted @ 2023-06-15 09:20  左扬  阅读(43)  评论(0编辑  收藏  举报
levels of contents