Fuzzy Query
Edit pageThe Fuzzy Query generates matching terms that are within the maximum edit
distance specified in _fuzziness (defaults to 2) and then checks the term
dictionary to find out which of those generated terms actually exist in the
index. The final query uses up to _max_expansions (defaults to 50) matching
terms.
Example
Section titled “Example”SEARCH /bank/
{ "_query": { "favoriteFruit": { "_fuzzy": "banna" } }}A similar effect could be obtained by using the tilde (“~”) character
followed optionally by the edit distance as part of the query text:
SEARCH /bank/
{ "_query": { "favoriteFruit": "banna~" }}Parameters
Section titled “Parameters”The following parameters are accepted by Boolean fields:
|--------------------------------------|-------------------------------------------------------|
| _fuzziness | The maximum edit distance. Defaults to 2. |
| _max_expansions | The maximum number of terms that the fuzzy query will expand to. Defaults to 50. |
| _prefix_length | The number of initial characters which will not be “fuzzified”. This helps to reduce the number of terms which must be examined. Defaults to 0. |
