gpt4 book ai didi

elasticsearch - 提升更像这个elasticsearch

转载 作者:行者123 更新时间:2023-12-04 06:01:45 25 4
gpt4 key购买 nike

我试图使用 elasticsearch 的 http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-mlt-query.html#query-dsl-mlt-query 为相关项目做一个简单的 POC ,

但是我不知道如何使用 boosting 以便我的文档中的重要字段在最终输出中具有更多的权重。另外,我如何在更像这个查询中应用提升,以便最近的文档具有更大的权重。

谢谢。

最佳答案

如果文档更像是特定文档或者匹配项位于特定字段,则实现特定提升的一种方法您可以使用多个 mlt 查询并将它们包装在 中。应该条款(bool)/dis_max 基于您在评分时是否想要“总和”/“最大”逻辑:

使用 dis_max 的示例是:

POST  test_index/_search?explain=true
{
"fields": [
"field1",
"field2"
],
"query": {
"dis_max": {
"queries": [
{
"more_like_this" : {
"fields" : ["field1"],
"like_text" : "this is some text",
"min_term_freq" : 1,
"max_query_terms" : 2,
"boost": 20
}
},
{
"more_like_this" : {
"fields" : ["field2"],
"like_text" : "this is some other text",
"min_term_freq" : 1,
"max_query_terms" : 2,
"boost": 20
}
}
]
}
}
}

关于elasticsearch - 提升更像这个elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26863350/

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