【发布时间】:2017-07-08 05:39:27
【问题描述】:
您好 Elasticsearch 专家,我需要您的帮助! 我们正在使用 Elasticsearch v5.4 和 我在 elasticsearch 中有多种嵌套类型,形式为:
"testLookup" : [
{
"id": 1001,
"name": "test1"
},
{
"id": 1002,
"name": "test2"
}
]
我正在尝试将名称显示为过滤器中的复选框选项。
我试图使用 post_filter 顶级元素来过滤聚合,这样我就可以只更新和显示受影响的过滤器选项,有点像这个演示网站上的使用方式:http://demo.searchkit.co
"post_filter": {
"bool":{
"must": [
{
"nested" : {
"path" : "testLookup",
"query": {
"bool": {
"filter":{
"bool":{
"should":[
{ "term": { "perTestLookup.name.keyword": "Adele"}}
]
}
}
}
}
}
},
{
"nested" : {
"path" : "testLookup2",
"query": {
"bool": {
"filter":{
"bool":{
"should":[
{ "term": { "perTestLookup2.name.keyword": "Gene" }}
]
}
}
}
}
}
}
]
}
}
如果我没记错的话,我认为 post_filter 所做的是在发送搜索请求之前为每个聚合应用过滤器,您可以通过在单击一个后查看搜索过滤器的请求有效负载来观察这一点过滤器复选框。
但是,我无法让 post_filter 将过滤器应用于聚合,只是没有应用过滤器。为什么会这样?不支持嵌套类型的 post_filter 吗?
我们将不胜感激任何提示或指导。谢谢!
【问题讨论】:
标签: elasticsearch elasticsearch-5