pub enum Fuzziness {
Auto,
Range(u8, u8),
Distance(u8),
}
Expand description
Some queries and APIs support parameters to allow inexact fuzzy matching,
using the fuzziness
parameter.
When querying text
or keyword
fields, fuzziness
is interpreted as a
Levenshtein Edit Distance
— the number of one character changes that need to be made to one string to make it the same as another string.
https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#fuzziness
Variants§
Auto
Generates an edit distance based on the length of the term.
AUTO
should generally be the preferred value for fuzziness
.
Range(u8, u8)
Low and high distance arguments may be optionally provided
AUTO:[low],[high]
. If not specified, the default values are 3 and 6,
equivalent to AUTO:3,6
that make for lengths:
0..2
Must match exactly
3..5
One edit allowed
>5
Two edits allowed
Distance(u8)
The maximum allowed Levenshtein Edit Distance (or number of edits)