Fuzzy

Fuzzy query

/ Fuzzy, / Query

Fuzzy query #

Returns documents that contain terms similar to the search term, within the maximum edit distance (Levenshtein — with transpositions counting as a single edit by default).

Use it when the indexed terms are only approximately known: typos in identifiers, OCR noise, or human-entered names.

Inside a nested query: not supported yet — the clause is rejected with an HTTP 400 naming the offending clause.

How it works #

The value is expanded against the inverted index’s term dictionary by edit distance, then the survivors’ postings are unioned like a should of term queries. The engine takes the union of three resolution passes — the value recorded as an exact term, a whole-value fuzzy walk, and (on non-keyword fields) a per-token walk after running the field’s search analyzer over the value — so the query works on keyword fields and on analyzed text alike (the per-token pass matters for CJK and multi-word input). On keyword fields the raw value is used, with the field’s normalizer applied first and no tokenization.

...