liveBook · Manning

Boost factor

As explained in Elasticsearch in Action, Second Edition

A numeric multiplier that increases the contribution of a field to a document's relevance score.

Use a boost factor when a search should prioritize one field over others. For example, boosting a book’s title helps title matches rank above equivalent matches in its synopsis. section 2.3.5

Write the multiplier after the field name with a caret: `title^3` makes title matches contribute three times their ordinary field weight. The larger score can move a document higher in the results. section 2.3.5

Listing 2.11 A multi_match query that boosts a field’s importance
GET books/_search
{
  "query": {
    "multi_match": {                      #1
      "query": "Java",
      "fields": ["title^3","synopsis"]    #2
    }
  }
}
#1 Searches through multiple fields
#2 A caret followed by the boost number indicates the field being boosted.

A multi-match query searches `title` and `synopsis`, while `title^3` gives the title greater importance for the query `Java`. section 2.3.5

A relevance score combines inverse document frequency, term frequency, and the boost factor. Set `explain` to `true`, or use `_explain`, to inspect how Elasticsearch calculated a document’s score. section 8.8.3

Inspecting a movie score

Run a match query for `Lord` with `"explain": true` to see the score calculation. Use `GET movies/_explain/14` when you want the explanation for one document, including whether it matched.

How Elasticsearch in Action, Second Edition covers it

How deep it goes
Explains caret syntax, ranking effects, score components, and score inspection through `explain` and `_explain`.
Examples
Uses a Java search across book title and synopsis, plus a movie-title search for Lord with score explanations.
What you can do after
Apply it via Elasticsearch multi-match JSON by assigning caret multipliers and diagnose resulting scores with `explain` or `_explain`.
How it connects
Connects multi-match queries with relevance scoring, term frequency, inverse document frequency, and the `_explain` API.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elasticsearch in Action, Second Edition. The section links point to the parts of the book it draws on.