O'Reilly logo

Elasticsearch 5.x Cookbook - Third Edition by Alberto Paro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the function score query

This kind of query is one of the most powerful queries available, because it allows extensive customization of scoring algorithm. The function score query allows defining a function that controls the score of the documents that are returned by a query.

Generally, these functions are CPU intensive and executing them on a large dataset requires a lot of memory, but computing them on a small subset can significantly improve the search quality.

The common scenarios used for this query are:

  • Creating a custom score function (with decay function, for example)
  • Creating a custom boost factor, for example, based on another field (that is, boosting a document by distance from a point)
  • Creating a custom filter score function, for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required