filter 没有排序 和score 但是有缓存,性能更高,先过滤,后查询排序
GET /blank/_search
{
"from": 0,
"size": 0,
"query": {
"bool": {
"filter": {
"range": {
"age": {
"gte": 10,
"lte": 40
}
}
}
}
},
"aggs": {
"single_avg_price": {
"avg": {
"field": "age"
}
}
}
}