liveBook · Manning

Field-length norm algorithm

As explained in Elasticsearch in Action, Second Edition

A field-length norm is a document-scoring factor that adjusts term relevance according to the length of the field containing the term.

When several documents contain the same search term, field length helps decide whether that term is genuinely informative. A match in a short title usually carries more weight than the same match buried in a long synopsis. section 3.4.1 section 3.4.2

The algorithm contributes to relevance scoring in three connected ways:

  • Counts term frequency: repeated occurrences of a search word in a field generally increase its score. section 3.4.2
  • Accounts for inverse document frequency: terms appearing throughout the index contribute less discriminating power. section 3.4.2
  • Normalizes for field length: a term appearing in a shorter field can be more relevant than the same term in a longer field. section 3.4.2 section 3.4.1

Java in book titles

Suppose a title search looks for Java. “Effective Java” contains two words, while “Head First Java” contains three; although both match, the shorter title can receive the stronger relevance score. A longer synopsis illustrates the same principle: one occurrence in a 100-word synopsis is less informative than two occurrences in a five-word title. section 3.4.1

Elasticsearch applies BM25 by default for this scoring example. Its b parameter controls term-frequency normalization based on document length and has a listed default of 0.75. Elasticsearch also supports other similarity algorithms and per-field similarity configuration; custom algorithms are an advanced option. section 3.4.1

How Elasticsearch in Action, Second Edition covers it

How deep it goes
Explains field length alongside term frequency and inverse document frequency, but defers detailed custom similarity implementation.
Examples
Compares Java matches in Effective Java, Head First Java, a short title, and a longer synopsis.
What you can do after
Evaluate search relevance by comparing matching terms across fields with different lengths and frequencies.
How it connects
Connects field-length normalization with BM25, term frequency, inverse document frequency, and similarity algorithms.

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.