gpt4 book ai didi

elasticsearch - Elasticsearch衰减参数

转载 作者:行者123 更新时间:2023-12-03 02:02:11 28 4
gpt4 key购买 nike

我有三组文档(例如,来自已注册,已验证和未注册用户的文档),我想使用衰减函数对其评分。

但是,对于这三组文档,我需要具有不同的衰减速度(缩放),以使来自经过验证的用户的文档比未经注册的用户的文档的顶端时间更长。

似乎无法将doc字段用作衰减函数的参数。也许还有其他方法可以实现我想要的?

最佳答案

可以使用 function_score 完成,该函数定义为“过滤器”:

{
"size": 100,
"query": {
"function_score": {
"score_mode": "multiply",
"query": {
"bool": {
"must": [
{
"term": {
"status": 0
}
},
{
"term": {
"categories": 29
}
}
]
}
},
"functions": [
{
"filter": {
"term": {
"user_type": 1
}
},
"weight": 1,
"gauss": {
"date_created": {
"scale": "7d",
"decay": 0.9
}
}
},
{
"filter": {
"not": {
"term": {
"user_type": 1
}
}
},
"weight": 0.8,
"gauss": {
"date_created": {
"scale": "7d",
"decay": 0.8
}
}
}
]
}
}
}

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

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