为了更好地理解API,我正在分析一些弹性搜索查询,我对这些查询感到困惑。
"query": {
"function_score": {
"query": {
"bool": {
"must": {
"match": {
"title_normalized": {
"query": "here goes the query",
"minimum_should_match": 2
}
}
},
"filter": ...
},
},
},
}在这种情况下,minimum_should_match有什么意义?没有应该子句,但我们在一个匹配子句中。
同样,这里
"query": {
"function_score": {
"query": {
"bool": {
"must": ...
"filter": {
"bool": {
"should": [{
"match": {
"title_normalized": {
"query": "here goes",
"minimum_should_match": 2
}
}
}, {
"match": {
"title_normalized": {
"query": "the query",
"minimum_should_match": 2
}
}
}],
"minimum_should_match": 1
}
}
},
},
},
}我理解"minimum_should_match": 1在与should相同的缩进级别,但是嵌套在match子句中的minimum_should_match又如何呢?这是什么意思?
发布于 2022-09-16 20:05:27
" match“子句中"minimum_should_match”的使用决定了要匹配的术语的最小数目。例:您有文档“来查询”,您的查询是:
"match": {
"title_normalized": {
"query": "here goes",
"minimum_should_match": 2
}
}您将检索文档,因为有两个匹配项。
如果将"minimum_should_match“更改为3,则不会有结果,因为匹配项的最小值为3,而查询只有2。
https://stackoverflow.com/questions/73747521
复制相似问题