gpt4 book ai didi

elasticsearch - Elasticsearch衰减函数得分

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

我正在尝试以下

PUT test/foo/1
{
"num": 100
}

GET test/foo/_search
{
"query" : {
"function_score" : {
"query" : {
"match" : {
"num": 100
}
},
"functions" : [
{
"filter" : {
"match_all" : {
}
},
"gauss" : {
"num" : {
"origin": 0,
"scale" : 500,
"offset" : 0,
"decay" : 0.1
},
"multi_value_mode" : "MIN"
}
}
],
"score_mode" : "sum",
"max_boost" : 3.4028235E38
}
}
}

---

{
"hits": {
"total": 1,
"max_score": 0.91201085,
"hits": [
{
"_index": "test",
"_type": "foo",
"_id": "1",
"_score": 0.91201085,
"_source": {
"num": 100
}
}
]
}
}

我使用总和作为评分模式。因为查询的分数是1,衰减函数的分数是 0.91201085,所以我期望分数是 1.91201085。我想念什么?

最佳答案

使用“boot_mode”:“sum”。您还可以在查询中使用explain了解文档的评分方式

POST testindexy/_search
{
"query" : {
"function_score" : {
"query" : {
"match" : {
"num": 100
}
},
"functions" : [
{
"filter" : {
"match_all" : {
}
},
"gauss" : {
"num" : {
"origin": 0,
"scale" : 500,
"offset" : 0,
"decay" : 0.1
},
"multi_value_mode" : "MIN"
}
}
],
"boost_mode": "sum",
"score_mode" : "sum",
"max_boost" : 3.4028235E38
}
}
}

关于elasticsearch - Elasticsearch衰减函数得分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42270038/

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