好的想法是十分钱一打,真正无价的是能够实现这些想法的人。

es能在聚合结果中显示每个桶里文档内容吗?

Elasticsearch | 作者 MCTW | 发布于2018年09月04日 | 阅读数:3995

比如 terms 聚合,本来结果类似
"buckets": [
{
"key": "red",
"doc_count": 1088
},
{
"key": "blue",
"doc_count": 960
},
...
]

希望每个桶包含涉及的文档内容,如:
{
"key": "red",
"doc_count": 1088,
"docs": [
{"color": "red", "price": 100, "_id": 1},
{"color": "red", "price": 80, "_id": 4},
。。。
]
}

es 支持吗?或者有什么其它方法能实现类似效果吗?谢过各位大佬。
已邀请:

bsll - ES认证考过咯,开心

赞同来自: zyb1994111 MCTW liuliuliu

top-hits应该可以满足https://www.elastic.co/guide/e ... .html

要回复问题请先登录注册