elasticsearch 在elasticsearch中从评分中删除增强项
有没有办法,我可以从弹性相关性评分中删除默认的boost项,或者将其设为1(这样它就不会反映在评分中)。比如说, 编辑:输入查询为
elasticsearch 在elasticsearch中从评分中删除增强项,
elasticsearch,boost,relevance,
elasticsearch,Boost,Relevance,有没有办法,我可以从弹性相关性评分中删除默认的boost项,或者将其设为1(这样它就不会反映在评分中)。比如说, 编辑:输入查询为 GET test_index/_search { "query": { "match": { "text": "asia pacific" } },"explain": true } 部分结果如下: "details" : [ { "value" : 6.5127892, "d
GET test_index/_search
{
"query": {
"match": {
"text": "asia pacific"
}
},"explain": true
}
部分结果如下:
"details" : [
{
"value" : 6.5127892,
"description" : "weight(text:asia in 5417) [PerFieldSimilarity], result of:",
"details" : [
{
"value" : 6.5127892,
"description" : "score(freq=6.0), product of:",
"details" : [
{
"value" : 2.2,
"description" : "boost",
"details" : [ ]
},
{
"value" : 3.8113363,
"description" : "idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:",
"details" : [
{
"value" : 462,
"description" : "n, number of documents containing term",
"details" : [ ]
},
{
"value" : 20909,
"description" : "N, total number of documents with field",
"details" : [ ]
}
]
},
{
"value" : 0.7767246,
"description" : "tf, computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:",
"details" : [
{
"value" : 6.0,
"description" : "freq, occurrences of term within document",
"details" : [ ]
},
{
"value" : 1.2,
"description" : "k1, term saturation parameter",
"details" : [ ]
},
{
"value" : 0.75,
"description" : "b, length normalization parameter",
"details" : [ ]
},
{
"value" : 1048.0,
"description" : "dl, length of field (approximate)",
"details" : [ ]
},
{
"value" : 662.01294,
"description" : "avgdl, average length of field",
"details" : [ ]
}
]
}
]
}
]
},
这是一个简单匹配查询中其中一个术语的解释。
在上面的示例中,我想删除boost项2.2或使其等于1。
请建议如何执行此操作。在查询中使用
bool->filter
而不是bool->must
。这正是问题所在。我目前正在使用一个简单的查询,GET test\u index/\u search{“query”:{“match”:{“text”:“asia pacific”}}
来获取结果,但是如果我使用,GET test\u index/\u search{“query”:{“bool”:{“filter”:{“term”:{“text”:{“text”:“asia pacific”}
,它返回0个结果。任何关于我在这里做错了什么的建议。这里已经回答了术语vs match:如果你想保持1分,请使用以下命令:{“query”:{“bool”:{“filter”:[{“match”:{“text”:“asia-pacific”}]}}}
谢谢你的建议。但我正在努力提高1分,而且仍然需要基于BM25的TF和IDF分数。使用bool->filter->match的这种格式会给出一个恒定的分数,这与我想要达到的不同。哦,我误解了你的问题。我认为你不能选择得分部分。。。您可以通过脚本或函数分数()调整最终分数,但不能分解匹配
评分策略。