当前位置:网站首页>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
边栏推荐
- Image processing in opencv -- Introduction to contour + contour features
- DVWA range practice record
- Chapter VIII project stakeholder management of information system project manager summary
- 个人主页软件Fenrus
- 1 + X cloud computing intermediate -- script construction, read-write separation
- 数据清洗 ETL 工具Kettle的安装
- STM32 and FreeRTOS stack parsing
- Leetcode question bank 78 Subset (recursive C implementation)
- Introduction to sap pi / PO login and basic functions
- High paid programmer & interview question series 91 limit 20000 loading is very slow. How to solve it? How to locate slow SQL?
猜你喜欢
如何实现根据照片获取地理位置及如何防御照片泄漏地理位置
JS node operation, why learn node operation
Emuelec compilation summary
LeetCode 1611. The minimum number of operations to make an integer 0
Leetcode0587. Install fence
3、 6 [Verilog HDL] gate level modeling of basic knowledge
Go language learning notes - slice, map | go language from scratch
《数字电子技术基础》3.1 门电路概述、3.2 半导体二极管门电路
#yyds干货盘点#ubuntu18.0.4安装mysql并解决ERROR 1698: Access denied for user ''root''@''localhost''
Personal homepage software fenrus
随机推荐
Go language learning notes - array | go language from scratch
Exclusive thoughts and cases of JS
Dropout技术之随机神经元与随机深度
Using JS to realize a thousandth bit
Secrets in buffctf file 1
Two ways for flutter providers to share data
Little girl walking
108. Convert an ordered array into a binary search tree
Leetcode0587. Install fence
Applet error: should have URL attribute when using navigateto, redirectto or switchtab
[reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)
Kettle experiment
Expansion of number theory Euclid
ABAP CDs view with association example
SAP ECC connecting SAP pi system configuration
Machine learning (VI) -- Bayesian classifier
Emuelec compilation summary
Summary of common concepts and problems of linear algebra in postgraduate entrance examination
Comparison of overloading, rewriting and hiding
AI上推荐 之 MMOE(多任务yyds)