boost

Individual fields can be boosted automatically — count more towards the relevance score — at query time, with the boost parameter as follows:

  1. PUT my-index-000001
  2. {
  3. "mappings": {
  4. "properties": {
  5. "title": {
  6. "type": "text",
  7. "boost": 2
  8. },
  9. "content": {
  10. "type": "text"
  11. }
  12. }
  13. }
  14. }

Matches on the title field will have twice the weight as those on the content field, which has the default boost of 1.0.

The boost is applied only for term queries (prefix, range and fuzzy queries are not boosted).

You can achieve the same effect by using the boost parameter directly in the query, for instance the following query (with field time boost):

  1. POST _search
  2. {
  3. "query": {
  4. "match": {
  5. "title": {
  6. "query": "quick brown fox"
  7. }
  8. }
  9. }
  10. }

is equivalent to:

  1. POST _search
  2. {
  3. "query": {
  4. "match": {
  5. "title": {
  6. "query": "quick brown fox",
  7. "boost": 2
  8. }
  9. }
  10. }
  11. }

Deprecated in 5.0.0.

Index time boost is deprecated. Instead, the field mapping boost is applied at query time. For indices created before 5.0.0, the boost will still be applied at index time.

Why index time boosting is a bad idea

We advise against using index time boosting for the following reasons:

  • You cannot change index-time boost values without reindexing all of your documents.
  • Every query supports query-time boosting which achieves the same effect. The difference is that you can tweak the boost value without having to reindex.
  • Index-time boosts are stored as part of the norm, which is only one byte. This reduces the resolution of the field length normalization factor which can lead to lower quality relevance calculations.