Boosting one or more fields

In an e-commerce type of web application,  the user intends to search for an item, and they might search for some keywords. What if we want the title field to be more important than the description? If one or more of the search terms appears in the title, it is definitely a more relevant product than the ones that have those values only in the description. It is possible to boost the score of the document if a match is found in a particular field.

Let's make the title field three times more important than the description field. This can be done by using the following syntax:

GET /amazon_products/_search
{
"query": {
"multi_match": {
"query": "monitor aquarium",
"fields": ["title^3", "description"]
}
}
}

The multi_match query offers more control regarding how to combine the scores from different fields. Let's look at the options.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset