当前位置:网站首页>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
边栏推荐
- NLLLoss+log_ SoftMax=CE_ Loss
- Kettle experiment (III)
- Two methods of building Yum source warehouse locally
- SAP RFC_ CVI_ EI_ INBOUND_ Main BP master data creation example (Demo customer only)
- MySQL of database -- basic common query commands
- How to obtain geographical location based on photos and how to prevent photos from leaking geographical location
- NPM reports an error: operation not allowed, MKDIR 'C: \ program files \ node JS \ node_ cache _ cacache’
- SAP salv14 background output salv data can directly save files and send emails (with sorting, hyperlink and filtering format)
- Number of islands
- ALV tree (ll LR RL RR) insert delete
猜你喜欢

Setnx command execution failed due to full redis memory

ABAP 7.4 SQL Window Expression

Number of islands

SAP salv14 background output salv data can directly save files and send emails (with sorting, hyperlink and filtering format)

ABAP CDs view with association example

108. Convert an ordered array into a binary search tree

Dropout技术之随机神经元与随机深度

npm ERR! network

What is monitoring intelligent playback and how to use intelligent playback to query video recording

【读书笔记】《Verilog数字系统设计教程》 第5章 条件语句、循环语句和块语句(附思考题答案)
随机推荐
nn. Explanation of module class
Three ways to create objects in JS
Give the method of instantiating the object to the new object
JS DOM learn three ways to create elements
Employee probation application (Luzhou Laojiao)
Number of islands
阿里云架构师解读四大主流游戏架构
Kettle experiment (III)
kernel-pwn学习(4)--Double Fetch&&0CTF2018-baby
STM32 and FreeRTOS stack parsing
Personal homepage software fenrus
Yyds dry goods inventory ubuntu18 0.4 install MySQL and solve error 1698: access denied for user ''root' '@' 'localhost' '
Leetcode0587. 安装栅栏(difficult)
《数字电子技术基础》3.1 门电路概述、3.2 半导体二极管门电路
Installation of data cleaning ETL tool kettle
SAP debug debug for in, reduce and other complex statements
JSON input of Chapter 14 of kettle paoding jieniu
ABAP publishes OData service samples from CDs view
kettle实验
golang力扣leetcode 396.旋转函数