【发布时间】:2019-12-20 03:24:15
【问题描述】:
在我的查询中,我使用inner_hits 返回与我的查询匹配的嵌套对象列表。
然后我为我的文档的 categoryId 添加一个聚合,然后添加一个热门聚合以获取该类别的显示名称。
"aggs": {
"category": {
"terms": {
"field": "categoryId",
"size": 100
},
"aggs": {
"category_value": {
"top_hits": {
"size": 1,
"_source": {
"includes": "categoryName"
}
}
}
}
}
}
现在,当我查看聚合存储桶时,我确实得到了一个只有 categoryName 属性的 _source 文档,但我也得到了整个 inner_hits 集合:
{
...
"_source": {
"categoryName": "Armchairs"
},
"inner_hits": {
"my_inner_hits": {
"hits": {
"total": 260,
"max_score": null,
"hits": [{
...
"_source": {
//nested document here
}
}
]
}
}
}
}
有没有办法不将inner_hits 数据包含在top_hits 聚合中?
【问题讨论】:
-
您好,请您添加您的整个查询和一些示例文档,好吗?很难理解你想要达到的目标。
标签: elasticsearch