gpt4 book ai didi

elasticsearch - 升级到Elasticsearch v7后,查询将返回所有结果

转载 作者:行者123 更新时间:2023-12-02 23:12:34 24 4
gpt4 key购买 nike

我正在尝试升级集群Elasticsearch v7,即使对于不可能的请求,我的查询似乎也会返回很多结果

以前,当搜索“qdsssq”时,我的搜索引擎什么也找不到。升级到v7后,类似的查询几乎返回结果。即使删除查询中的所有should子句,我也会得到很多结果。但是,评分似乎仍然有效,而且我键入合理的查询,我确实确实首先获得了最相关的结果(但即使是不匹配的结果也是如此)。您能帮我解决问题吗?

这是我在elasticsearch v5上触发的查询示例,该查询产生了预期的结果(现在看来最终在ESv7上返回整个数据库)。为了简单起见,我只为FR / EN包含了一个should

{
index: "profiles",
type: nil,
body: {
query: {
function_score: {
query: {
bool: {
disable_coord: true,
filter: {
bool: {
filter: [{
term: {
indexable: true
}
}],
should: [{
match_phrase: {
: "description.french" => {
query: "qdsssq",
boost: 1,
slop: 50,
analyzer: "french_heavy"
}
}
}, {
match_phrase: {
: "description.english" => {
query: "qdsssq",
boost: 1,
slop: 50,
analyzer: "english"
}
}
}]
}
},
should: [{
match_phrase: {
: "description.french" => {
query: "qdsssq",
boost: 1,
slop: 50,
analyzer: "french_heavy"
}
}
}, {
match_phrase: {
: "description.english" => {
query: "qdsssq",
boost: 1,
slop: 50,
analyzer: "english"
}
}
}]
}
},
functions: [],
score_mode:: sum,
boost_mode:: multiply
}
}
},
size: 12,
from: 0
}

我是否错过了一些可以解释这一点的重大变化? the removal of the filter context(不确定是什么意思)是否相关?如何解决查询,使根本不匹配的结果不包括在结果中?

我在用
-AWS上的Elasticsearch v7.1
-Ruby gem elasticsearch-7.3.0

最佳答案

是的,这与您所引用的过滤器上下文的删除有关。

请尝试在两个minimum_should_match: 1查询中设置bool

您可能还会发现this answer有用。

关于elasticsearch - 升级到Elasticsearch v7后,查询将返回所有结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58721741/

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