Rescoring
For a query that matches a lot of documents, scoring all the matching documents can be quite expensive. To reduce this cost and improve the precision, Elasticsearch lets you rescore only the top N documents without scoring all the documents that match the query. Expensive scoring queries, such as scripting or using geolocation, can be used in the rescore phrase. The scores from the original query and the rescore query are combined for the final score. For example, you want the distance as one of the factors driving the relevance score, but the geo distance query which is used to calculate the distance is expensive. You can use the main query to calculate the score for all the documents and then use rescoring to order only the top ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access