当前位置:网站首页>Es aggregation aggregation analysis
Es aggregation aggregation analysis
2022-04-23 09:41:00 【ALONG20】
Classification of sets
Bucket Aggregation
A set of documents whose columns meet certain criteria .
Metric Aggregation
Some mathematical operations , You can perform statistical analysis on document fields .
Metric Will calculate the results based on the dataset , In addition to support the calculation on the field , Also support in the footsteps (painless script) Calculate on the results .
majority Metric It's math , Output only one value .
min / max / sum / avg / cardinality
part Metric Support the output of multiple values .
stats / percentiles /percentile_ranks
actual combat : Check the flight destination / Statistics of the place of departure 、 Average ticket price 、 The most expensive ticket price 、 The cheapest ticket price
get kibana_sample_data_flights/_mappings
# Output
{
"kibana_sample_data_flights" : {
"mappings" : {
"properties" : {
"AvgTicketPrice" : {
"type" : "float"
},
"Cancelled" : {
"type" : "boolean"
},
"Carrier" : {
"type" : "keyword"
},
"Dest" : {
"type" : "keyword"
},
"DestAirportID" : {
"type" : "keyword"
},
"DestCityName" : {
"type" : "keyword"
},
"DestCountry" : {
"type" : "keyword"
},
"DestLocation" : {
"type" : "geo_point"
},
"DestRegion" : {
"type" : "keyword"
},
"DestWeather" : {
"type" : "keyword"
},
"DistanceKilometers" : {
"type" : "float"
},
"DistanceMiles" : {
"type" : "float"
},
"FlightDelay" : {
"type" : "boolean"
},
"FlightDelayMin" : {
"type" : "integer"
},
"FlightDelayType" : {
"type" : "keyword"
},
"FlightNum" : {
"type" : "keyword"
},
"FlightTimeHour" : {
"type" : "keyword"
},
"FlightTimeMin" : {
"type" : "float"
},
"Origin" : {
"type" : "keyword"
},
"OriginAirportID" : {
"type" : "keyword"
},
"OriginCityName" : {
"type" : "keyword"
},
"OriginCountry" : {
"type" : "keyword"
},
"OriginLocation" : {
"type" : "geo_point"
},
"OriginRegion" : {
"type" : "keyword"
},
"OriginWeather" : {
"type" : "keyword"
},
"dayOfWeek" : {
"type" : "integer"
},
"timestamp" : {
"type" : "date"
}
}
}
}
}
get kibana_sample_data_flights/_search
{
"size":0,
"aggs":{
"flight_dest":{
// similar select DestCountry count(*) from x group by DestCountry
"terms":{
"field": "DestCountry"
},
//aggs Turn on Statistics
"aggs": {
// average_price Storage statistics result name
"average_price": {
//avg Is a statistical function
"avg": {
// according to AvgTicketPrice Field for Statistics
"field": "AvgTicketPrice"
}
},
"max_price":{
"max": {
"field": "AvgTicketPrice"
}
},
"min_price":{
"min": {
"field": "AvgTicketPrice"
}
},
"stat_price":{
//stats contain min/max/avg/sum Statistics
"stats": {
"field": "AvgTicketPrice"
}
},
"weather":{
"terms": {
"field": "DestWeather"
}
}
}
}
}
}
Results output :
{
"took" : 18,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"flight_dest" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 3187,
"buckets" : [
{
"key" : "IT",
"doc_count" : 2371,
"max_price" : {
"value" : 1195.3363037109375
},
"min_price" : {
"value" : 100.57646942138672
},
"weather" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Clear",
"doc_count" : 428
},
{
"key" : "Sunny",
"doc_count" : 424
},
{
"key" : "Rain",
"doc_count" : 417
},
{
"key" : "Cloudy",
"doc_count" : 414
},
{
"key" : "Heavy Fog",
"doc_count" : 182
},
{
"key" : "Damaging Wind",
"doc_count" : 173
},
{
"key" : "Hail",
"doc_count" : 169
},
{
"key" : "Thunder & Lightning",
"doc_count" : 164
}
]
},
"average_price" : {
"value" : 586.9627099618385
},
"stat_price" : {
"count" : 2371,
"min" : 100.57646942138672,
"max" : 1195.3363037109375,
"avg" : 586.9627099618385,
"sum" : 1391688.585319519
}
}
]
}
}
}
Pipeline Aggregation
Second polymerization of other polymerization results .
Matrix Aggregation
Support the operation of multiple fields and provide a result matrix .
版权声明
本文为[ALONG20]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230933480828.html
边栏推荐
- Go language learning notes - structure | go language from scratch
- Random neurons and random depth of dropout Technology
- kernel-pwn学习(4)--Double Fetch&&0CTF2018-baby
- Cross domain configuration error: when allowcredentials is true, allowedorigins cannot contain the special value "*“
- Two declaration methods of functions of JS
- MySQL - Chapter 1 (data type 2)
- Go language learning notes - language interface | go language from scratch
- Your guide to lowering your cholesterol with TLC (continuously updated)
- Kettle实验 转换案例
- 501. Mode in binary search tree
猜你喜欢
Cloud computing competition -- basic part of 2020 competition [task 3]
Personal homepage software fenrus
SAP ECC connecting SAP pi system configuration
Two methods of building Yum source warehouse locally
JS node operation, why learn node operation
Practice of Flink streaming batch integration in Xiaomi
Applet error: should have URL attribute when using navigateto, redirectto or switchtab
kernel-pwn学习(3)--ret2user&&kernel ROP&&QWB2018-core
SAP pi / PO soap2proxy consumption external WS example
SAP RFC_ CVI_ EI_ INBOUND_ Main BP master data creation example (Demo customer only)
随机推荐
Go language learning notes - language interface | go language from scratch
Kettle experiment conversion case
Three ways to create objects in JS
112. Path sum
MySQL of database -- Fundamentals
501. 二叉搜索树中的众数
MySQL of database -- overview and installation
《數字電子技術基礎》3.1 門電路概述、3.2 半導體二極管門電路
Go language learning notes - exception handling | go language from scratch
Kettle实验 转换案例
How to obtain geographical location based on photos and how to prevent photos from leaking geographical location
云身份过于宽松,为攻击者打开了大门
(Extended) bsgs and higher order congruence equation
ALV树(LL LR RL RR)插入删除
JS what is an event? Event three elements and operation elements
Redis 内存占满导致的 Setnx 命令执行失败
JS and how to judge custom attributes in H5
Kettle experiment (III)
Dropout技术之随机神经元与随机深度
653. Sum of two IV - input BST