|NO.Z.00030|——————————|BigDataEnd|——|Hadoop&ElasticSearch.V30|——|ELK.v30|集群|QueryDSL|聚合分析.V1|

一、聚合分析
### --- 聚合介绍

~~~     聚合分析是数据库中重要的功能特性,完成对一个查询的数据集中数据的聚合计算,
~~~     如:找出某字段(或计算表达式的结果)的最大值、最小值,计算和、平均值等。
~~~     Elasticsearch作为搜索引擎兼数据库,同样提供了强大的聚合分析能力。
~~~     对一个数据集求最大、最小、和、平均值等指标的聚合,
~~~     在ES中称为指标聚合 metric 而关系型数据库中除了有聚合函数外,
~~~     还可以对查询出的数据进行分组group by,再在组上进行指标聚合。
~~~     在 ES 中group by 称为分桶,桶聚合bucketing
~~~     Elasticsearch聚合分析语法 在查询请求体中以aggregations节点按如下语法定义聚合分析:
### --- 语法:说明:aggregations 也可简写为 aggs

"aggregations" : {
"<aggregation_name>" : { <!--聚合的名字 -->
"<aggregation_type>" : { <!--聚合的类型 -->
<aggregation_body> <!--聚合体:对哪些字段进行聚合 -->
}
[,"meta" : { [<meta_data_body>] } ]? <!--元 -->
[,"aggregations" : { [<sub_aggregation>]+ } ]? <!--在聚合里面在定义子聚合 -->
}
}

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on 2022-04-15 14:19  yanqi_vip  阅读(25)  评论(0)    收藏  举报

导航