How to boost relevance based on a single field

Although the default scoring algorithm (BM25) works for most cases, it is not domain or application specific. The ranking is purely based on the content of the document. Sometimes, a ranking based on just the content may not suffice. For example, for a user looking for a restaurant, along with his preferences, we may also need to factor the distance of a restaurant from the current user location. The restaurants closer to the user are scored better than the ones that are not. In an e-commerce world, we want to factor both price and rating of the product while scoring the products. Maybe the user can compromise on the price of the product, given there are good ratings and so on.

Just like we used ...

Get Learning Elasticsearch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.