WARNING: The 2.x versions of Elasticsearch have passed their EOL dates. If you are running a 2.x version, we strongly advise you to upgrade.
This documentation is no longer maintained and may be removed. For the latest information, see the current Elasticsearch documentation.
Scoring Fuzzinessedit
Users love fuzzy queries. They assume that these queries will somehow magically find the right combination of proper spellings. Unfortunately, the truth is somewhat more prosaic.
Imagine that we have 1,000 documents containing “Schwarzenegger,” and just one document with the misspelling “Schwarzeneger.” According to the theory of term frequency/inverse document frequency, the misspelling is much more relevant than the correct spelling, because it appears in far fewer documents!
In other words, if we were to treat fuzzy matches like any other match, we would favor misspellings over correct spellings, which would make for grumpy users.
Fuzzy matching should not be used for scoring purposes—only to widen the net of matching terms in case there are misspellings.
By default, the match
query gives all fuzzy matches the constant score of 1.
This is sufficient to add potential matches onto the end of the result list,
without interfering with the relevance scoring of nonfuzzy queries.
Fuzzy queries alone are much less useful than they initially appear. They are
better used as part of a “bigger” feature, such as the search-as-you-type
completion
suggester or the
did-you-mean phrase
suggester.