我有一个非常简单的查询:
match: {
field => {
boost: 4,
query: term,
fuzziness: 'AUTO',
}
}
由几个(大约 10 个)其他查询组成,其中大多数使用 constant_score。问题是,在特定条件下,我的查询得分太大,会取消所有其他查询结果。
这是解释的一部分:
"details" => [
[0] {
"value" => 63.656006,
"description" => "sum of:",
"details" => [
[0] {
"value" => 63.656006,
"description" => "weight(title.de:kandinsky in 1694239) [PerFieldSimilarity], result of:",
"details" => [
[0] {
"value" => 63.656006,
"description" => "score(doc=1694239,freq=1.0 = termFreq=1.0\n), product of:",
"details" => [
[0] {
"value" => 4.0,
"description" => "boost",
"details" => []
},
[1] {
"value" => 11.3820715,
"description" => "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
[...]
你能看到吗,由于 IDF,我的分数是 11.38。我的其他查询(分数在 1 到 3 之间)完全没用。
我的问题是:
如何设置查询的最大可能分数?
或者,更好的是,我可以为我的查询设置分数范围吗?
我想避免对该字段进行 constant_score 查询,我需要一些 TF/IDF 和该字段的分数概念,但不是那么强。
我试过这个:
function_score: {
query: { match: {
field => term,
}},
score_mode: :avg,
script_score: {
script: {
inline: "4 * (1 + Math.log(2 + _score))",
}
},
}
它更好,但它仍然可以在某些情况下获得非常高的分数。