Multi match query boosting

Hi all . Today I am going to use elasticsearch as I have sql query converted to es query, but there is an error associated with boosting. So I can not create multi match query where I can boost a filed result. I am doing search on title,body and name fileds and I want to give a priority to title , than to body , so saying I want to multply title result by 3 , body result by 1.5 and name result by 0.5. Please help me to create query . Thanks!

The syntax for boost a field depends on the client you are using. The
Elasticsearch documentation has a good example of how to boost a field when
using JSON. From
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#_literal_fields_literal_and_per_field_boosting

{
"query": {
"multi_match" : {
"query" : "this is a test",
"fields" : [ "subject^3", "message" ]
}
}
}

In that example, the subject field is boost by 3, while the message remains
unboosted.

Note that the default type is "best_fields", which means the score will be
for the highest scoring field. If you want to sum the scores of all the
fields as a final result, set the type to "most_fields"
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#multi-match-types

Cheers,

Ivan

I have already got the solution . Thank you very much!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.