gpt4 book ai didi

elasticsearch - Elasticsearch Score文档按相同字段值

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

假设您有5位来自相同用户的产品,而您列出了它们
如果 user_id (字段)在5个文档中具有相同的值,我希望第五个文档的文档分数最少
分数应该从第一下降到第五

预期成绩

"hits": [
{
"_type": "product",
"_id": "74162",
"_score": 1,
"_source": {
"user_id": 90
}
},
{
"_type": "product",
"_id": "6",
"_score": 1,
"_source": {
"user_id": 35
}
}
{
"_type": "product",
"_id": "2",
"_score": 0.9,
"_source": {
"user_id": 90
}
},
{
"_type": "product",
"_id": "3",
"_score": 0.8,
"_source": {
"user_id": 90
}
},
{
"_type": "product",
"_id": "4",
"_score": 0.7,
"_source": {
"user_id": 90
}
},
{
"_type": "product",
"_id": "5",
"_score": 0.6,
"_source": {
"user_id": 90
}
}

]

最佳答案

您是否在使用分数而不是订购结果?如果没有,那么您可以通过user_id订购

还可以指定定义这些结果相关性的内容吗?

关于elasticsearch - Elasticsearch Score文档按相同字段值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48767847/

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