您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
elasticSearch最大聚合
发布时间:2021-09-03 11:52:30编辑:雪饮阅读()
ElasticSearch最大聚合,顾名思义就是求最大值的聚合。
此聚合api比较简单。
一个请求如:
请求正文:
{
"aggs" : {
"max_fees" : { "max" : { "field" : "fees" } }
}
}
响应正文:
{
"took": 46,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 5,
"relation": "eq"
},
"max_score": null,
"hits": []
},
"aggregations": {
"max_fees": {
"value": 5000.0
}
}
}
这里对schools中的文档中按每个文档的fees字段求最大值。
关键字词:elasticSearch,最大值,max,最大聚合