Skip to content

Commit

Permalink
Update fuzzy.md (#7842) (#7870)
Browse files Browse the repository at this point in the history
  • Loading branch information
opensearch-trigger-bot[bot] committed Jul 30, 2024
1 parent 25d87fc commit e55c20b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions _query-dsl/term/fuzzy.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ nav_order: 20

# Fuzzy query

A fuzzy query searches for documents containing terms that are similar to the search term within the maximum allowed [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance). The Levenshtein distance measures the number of one-character changes needed to change one term to another term. These changes include:
A fuzzy query searches for documents containing terms that are similar to the search term within the maximum allowed [Damerau–Levenshtein distance](https://en.wikipedia.org/wiki/Damerau–Levenshtein_distance). The Damerau–Levenshtein distance measures the number of one-character changes needed to change one term to another term. These changes include:

- Replacements: **c**at to **b**at
- Insertions: cat to cat**s**
- Deletions: **c**at to at
- Transpositions: **ca**t to **ac**t

A fuzzy query creates a list of all possible expansions of the search term that fall within the Levenshtein distance. You can specify the maximum number of such expansions in the `max_expansions` field. Then it searches for documents that match any of the expansions.
A fuzzy query creates a list of all possible expansions of the search term that fall within the Damerau-Levenshtein distance. You can specify the maximum number of such expansions in the `max_expansions` field. The query then searches for documents that match any of the expansions. If you set the `transpositions` parameter to `false`, then your search will use the classic [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance).

The following example query searches for the speaker `HALET` (misspelled `HAMLET`). The maximum edit distance is not specified, so the default `AUTO` edit distance is used:

Expand Down Expand Up @@ -90,4 +90,4 @@ Specifying a large value in `max_expansions` can lead to poor performance, espec
{: .warning}

If [`search.allow_expensive_queries`]({{site.url}}{{site.baseurl}}/query-dsl/index/#expensive-queries) is set to `false`, fuzzy queries are not run.
{: .important}
{: .important}

0 comments on commit e55c20b

Please sign in to comment.