gpt4 book ai didi

Elasticsearch:[filtered] 查询不支持 [highlight]

转载 作者:行者123 更新时间:2023-11-29 02:48:16 25 4
gpt4 key购买 nike

我是 Elasticsearch 的新手。我有一个过滤查询如下

{
"query": {
"filtered" : {
"query" : {
"term" : {
"title" : "crime"
}
},
"highlight" : {
"fields" : {
"title" : {}
}
},
"filter" : {
"term" : { "year" : 1961 }
}
}
}
}

当我尝试这个查询并得到错误时:

[filtered] query does not support [highlight]

过滤查询是否支持高亮显示?如果没有,如何使用过滤器在查询中突出显示?我必须使用过滤器。

谢谢和问候!

最佳答案

"highlight" 参数应该与 "query" 参数处于同一级别,而不是嵌入其中。在您的情况下,它应该看起来像这样:

{
"query": {
"filtered" : {
"query" : {
"term" : {
"title" : "crime"
}
},
"filter" : {
"term" : { "year" : 1961 }
}
}
},
"highlight" : {
"fields" : {
"title" : {}
}
}
}

关于Elasticsearch:[filtered] 查询不支持 [highlight],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25099537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com