1

我需要在弹性搜索中为特定查询添加搜索相关性分数。如何在查询时为特定文件添加提升分数?

4

1 回答 1

5

If you look at http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html it shows you how to add boosting to a field at query time. For example

{
    "query_string" : {
    "fields" : ["content", "name^5"],
    "query" : "this AND that OR thus",
    "use_dis_max" : true
}

Note however there is potential for this to slow down your query considerably so I would test it or use boosting in the mapping file.

于 2011-10-20T17:30:52.917 回答