gpt4 book ai didi

elasticsearch - Elasticsearch MultiMatch查询仅匹配最后一项

转载 作者:行者123 更新时间:2023-12-03 01:46:44 25 4
gpt4 key购买 nike

我对具有几个术语的多个字段进行了multymatch查询:

{
"multi_match": {
"query": ["екатеринбург", "тимирязева"],
"fields": [
"admin0_name^1.0",
"admin0_alternate_names^0.95",
"local_admin_name^0.6",
"locality_name^1.2",
"locality_alternate_names^1.15",
"neighborhood_name^0.3",
"street_name^1.4",
"housenumber^1.4",
"housenumber_exact^1.5",
"name.text^2.0"],
"type": "most_fields",
"_name": "main_search_query"
}
}

术语 екатеринбург应该匹配 locality_name,并且 тимирязева应该匹配 street_namename.text

但是查询说明告诉我,只有 тимирязева被匹配:
    1.0168997 = (MATCH) product of:
5.0844984 = (MATCH) sum of:
3.4778461 = (MATCH) weight(name.text:тимирязева^2.0 in 233899) [PerFieldSimilarity], result of:
3.4778461 = score(doc=233899,freq=2.0), product of:
0.39484683 = queryWeight, product of:
2.0 = boost
9.965216 = idf(docFreq=184, maxDocs=1447823)
0.019811254 = queryNorm
8.808089 = fieldWeight in 233899, product of:
1.4142135 = tf(freq=2.0), with freq of:
2.0 = termFreq=2.0
9.965216 = idf(docFreq=184, maxDocs=1447823)
0.625 = fieldNorm(doc=233899)
1.6066521 = (MATCH) weight(street_name:тимирязева^1.4 in 233899) [PerFieldSimilarity], result of:
1.6066521 = score(doc=233899,freq=2.0), product of:
0.22453468 = queryWeight, product of:
1.4 = boost
8.095495 = idf(docFreq=1199, maxDocs=1447823)
0.019811254 = queryNorm
7.1554747 = fieldWeight in 233899, product of:
1.4142135 = tf(freq=2.0), with freq of:
2.0 = termFreq=2.0
8.095495 = idf(docFreq=1199, maxDocs=1447823)
0.625 = fieldNorm(doc=233899)
0.2 = coord(2/10)

为确保 екатеринбург本身与 locality_name匹配,我已将该查询与术语查询结合​​在一起, bool(boolean) 查询的必填部分也是如此。它匹配。

如果我将查询数组中的术语顺序更改为 ["тимирязева", "екатеринбург"],情况将变为完全相反,则 екатеринбург匹配 locality_name,但 тимирязева不匹配 street_name

看起来 multi_match仅考虑了最后一项。

N.b.我使用的是ES的较旧版本:1.4是一个错误,还是 multi_match的工作方式错误?

我可以采用一种解决方法:将查询用作字符串而不是查询,但是我很想知道为什么预 token 化方法会失败。

最佳答案

尝试一下,可能会帮助您:-

Query_string比multi_match更强大。 link

{
"query": {
"query_string": {
"fields" : ["admin0_name*",
"admin0_alternate_names*",
"local_admin_name*",
"locality_name*",
"locality_alternate_names*",
"neighborhood_name*",
"street_name*",
"housenumber*",
"housenumber_exact*",
"name.text*"] ,
"query": "*екатеринбург*" OR "*тимирязева*"
}
}
}

这是我的分析,query_string在部分搜索 link 中如何更强大

关于elasticsearch - Elasticsearch MultiMatch查询仅匹配最后一项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43383019/

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