好的想法是十分钱一打,真正无价的是能够实现这些想法的人。

如何理解es的百分位数聚合(Percentiles Aggregation)?

Elasticsearch | 作者 luohuanfeng | 发布于2018年09月19日 | 阅读数:9839

Percentiles Aggregation 结果是如何计算出来的?
没能理解英文官方文档里写的内容...


"Percentiles show the point at which a certain percentage of observed values occur. For example, the 95th percentile is the value which is greater than 95% of the observed values.

Percentiles are often used to find outliers. In normal distributions, the 0.13th and 99.87th percentiles represents three standard deviations from the mean. Any data which falls outside three standard deviations is often considered an anomaly.

When a range of percentiles are retrieved, they can be used to estimate the data distribution and determine if the data is skewed, bimodal, etc."
 


下面是我自己做的例子:
我有一个索引, 索引内有age字段,值分别是 5, 5, 6, 19, 20, 60.
  "aggregations": {
"b_age": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 5,
"doc_count": 2
},
{
"key": 6,
"doc_count": 1
},
{
"key": 19,
"doc_count": 1
},
{
"key": 20,
"doc_count": 1
},
{
"key": 60,
"doc_count": 1
}
]
}
}

然后使用percentiles聚合统计出   1, 5,  25,  50,  75,  95,   99 百分位的值.
结果是
  "aggregations": {
"p_agg": {
"values": {
"1.0": 5,
"5.0": 5,
"25.0": 5,
"50.0": 12.5,
"75.0": 20,
"95.0": 60,
"99.0": 60
}
}
}
这个结果是如何计算出来的?应该怎么看?
已邀请:

luohuanfeng

赞同来自: DuHuang

解决了 ,,,去看了一下百分位数的概念 ,找到了计算公式
百分位数的概念及计算

要回复问题请先登录注册