# 聚合分析中的不同作用域
# query/filter/post_filter/global(用来忽略query范围)
POST kibana_sample_data_flights/_search
{
"size": 1,
"query": {
"range": {
"AvgTicketPrice": {
"gte": 100,
"lte": 1000
}
}
},
"aggs": {
"Dests": {
"terms": {
"field": "Dest",
"size": 10
}
}
}
}
POST kibana_sample_data_flights/_search
{
"size": 0,
"aggs": {
"Dests_filter_range": {
"filter": {
"range": {
"Dest": {
"from":10000
}
}
},
"aggs": {
"Dests": {
"terms": {
"field": "Dest",
"size": 10
}
}
}
}
}
}
POST kibana_sample_data_flights/_search
{
"aggs": {
"Dests": {
"terms": {
"field": "Dest"
}
}
},
"post_filter": {
"match":{
"Dest":"Verona Villafranca Airport"
}
}
}
POST kibana_sample_data_flights/_search
{
"size": 1,
"query": {
"range": {
"Dest": {
"gte": 10000
}
}
},
"aggs": {
"Dests": {
"terms": {
"field": "Dest",
"size": 10
}
},
"all": {
"global": {},
"aggs": {
"all_AvgTicketPrice": {
"avg": {
"field": "AvgTicketPrice"
}
}
}
}
}
}