【发布时间】:2019-06-18 15:10:24
【问题描述】:
我是 ES 新手,正在为嵌套聚合而苦苦挣扎。 这是我的虚拟数据对象([这是我的数据对象][1][1]:https://i.stack.imgur.com/X7oaM.png)。我只是想从“现代”领域中获得最低成本。
关于我要解决的问题,我已阅读以下帖子。他们都没有帮助我解决问题
- Elastic Search 6 Nested Query Aggregations
- https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-nested-aggregation.html
- https://madewithlove.be/elasticsearch-aggregations/
- https://iridakos.com/tutorials/2018/10/22/elasticsearch-bucket-aggregations.html
- https://github.com/elastic/elasticsearch/issues/9317
此外,我搜索了整个 stackoverflow 并没有成功(是,我尝试了几乎所有遇到的解决方案,但都没有成功)。
根据文档和上述帖子等,嵌套聚合应按如下方式运行:
GET /loquesea/_search
{
"size": 0,
"aggs": {
"modern_costs": {
"nested": {
"path": "modern"
},
"aggs": {
"min_cost": {
"min": {
"field": "modern.cost1"
}
}
}
}
}
}
但是,完成后,我得到的是:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 0.0,
"hits" : [ ]
},
"aggregations" : {
"modern_costs" : {
"doc_count" : 0
}
}
}
我花了好几个小时试图让一个基本的嵌套聚合工作。我做错了什么?
【问题讨论】:
标签: elasticsearch nested aggregation