December 2017
Intermediate to advanced
434 pages
10h 29m
English
By default, the range query assigns a score of 1 to each matching document. What if you are using a range query in conjunction with some other query and you want to assign a higher score to the resulting document if it satisfies some criteria? We will look at compound queries like the bool query, where you can combine multiple types of queries. The range query allows you to provide a boost parameter to boost its score relative to other query/queries that it is combined with:
GET /amazon_products/products/_search{ "from": 0, "size": 10, "query": { "range": { "price": { "gte": 10, "lte": 20, "boost": 2.2 } } }}
All documents which pass the filter will have a score of 2.2 instead of 1 in this query.
Read now
Unlock full access