Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance.
An edit distance is the number of one-character changes needed to turn one term into another. These changes can include:
- Changing a character (box → fox)
- Removing a character (black → lack)
- Inserting a character (sic → sick)
- Transposing two adjacent characters (act → cat)
To find similar terms, the
fuzzy query creates a set of all possible
variations, or expansions, of the search term within a specified edit distance.
The query then returns exact matches for each expansion.
(Required, string) Term you wish to find in the provided
- (Optional, string) Maximum edit distance allowed for matching. See Fuzziness for valid values and more information.
(Optional, integer) Maximum number of variations created. Defaults to
Avoid using a high value in the
max_expansionsparameter, especially if the
prefix_lengthparameter value is
0. High values in the
max_expansionsparameter can cause poor performance due to the high number of variations examined.
(Optional, integer) Number of beginning characters left unchanged when creating
expansions. Defaults to
(Optional, boolean) Indicates whether edits include transpositions of two
adjacent characters (ab → ba). Defaults to
(Optional, string) Method used to rewrite the query. For valid values and more
information, see the
Fuzzy queries will not be executed if
is set to false.