Users typing "naутбук" instead of "ноутбук" or "javascipt" instead of "javascript" leave without finding the right product. We solve this by configuring fuzzy search in Elasticsearch. The core is Levenshtein distance: the number of single-character edits (insert, delete, substitute, transpose) needed to change one string into another. See more at Levenshtein distance.
Such typos cause up to 30% of empty search results in large e-commerce stores. Our engineers with 5 years of Elasticsearch experience set up fuzzy search end-to-end. We ensure 99% of user typos are handled correctly while keeping search speed acceptable even on multi-million document indices. Request a free consultation — we'll analyze your search profile and suggest optimal settings.
Choosing fuzziness for Your Project
The key parameter is fuzziness. It determines how many edits are allowed. AUTO is 5x more accurate on short queries than fixed fuzziness: 2.
| Value | Description | Example for "ноутбук" (8 chars) |
|---|---|---|
| 0 | Exact match | Only "ноутбук" |
| 1 | 1 edit operation | "ноутбук", "ноутбу" (deletion) |
| 2 | 2 edits | "ноутбук", "наутбук" (substitution), "ноубук" (deletion+substitution) |
AUTO |
0 for length 1-2, 1 for 3-5, 2 for 6+ | For "ноутбук" (8) → 2 |
AUTO is optimal in most cases. Forcing fuzziness: 2 on short queries generates too many false matches.
Why prefix_length Is Critical for Performance
Without prefix_length, every token in the index becomes a candidate for fuzzy expansion. For an index with 10M documents, this can cause tens of thousands of I/O operations. Setting prefix_length: 2 reduces candidates by an order of magnitude. For databases with technical terms (codes, SKUs), we recommend increasing to 3–4.
Example Fuzzy Query
POST /products/_search { "query": { "fuzzy": { "title": { "value": "наутбук", "fuzziness": "AUTO", "prefix_length": 2, "max_expansions": 50, "transpositions": true } } } } prefix_length — first 2 characters must match exactly. Without it, fuzziness: 2 on a one-letter query "a" could match an enormous number of tokens. Set at least 1–2.
max_expansions — maximum number of variations the fuzzy query expands into. Default 50 is usually sufficient.
transpositions — allow swapping adjacent characters (ab → ba). Enabled by default. This corresponds to Damerau–Levenshtein distance.
Fuzzy Query vs Match with Fuzziness
| Criterion | Fuzzy Query | Match Query with Fuzziness |
|---|---|---|
| Query analysis | No, raw value | Yes, tokenization and normalization |
| Application | To one field | To each token after analysis |
| Grammatical forms | Not considered | Considered (stemming, synonyms) |
| Recommendation | For unique identifiers | For user search strings |
Combining Exact and Fuzzy Search
Best practice: run exact and fuzzy searches in parallel, boosting exact results to the top:
POST /products/_search { "query": { "bool": { "should": [ { "multi_match": { "query": "наутбук", "fields": ["title^3", "description"], "boost": 2 } }, { "multi_match": { "query": "наутбук", "fields": ["title^3", "description"], "fuzziness": "AUTO", "prefix_length": 2, "boost": 1 } } ] } } } Exact matches with boost 2 rank higher than fuzzy ones. Documents with exact matches rise to the top; fuzzy ones still appear but lower.
Our Experience: Electronics Store Case
A client with 500K products often saw brand typos: "samsung", "samsun", "samsung". We configured fuzzy search with fuzziness: AUTO and prefix_length: 2 on title, brand, and description fields. Search time increased by 15%, but zero-result rate dropped from 8% to 0.5%. Additionally, we added a phonetic analyzer (Double Metaphone) for English brands. This saved about 30% in budget by using built-in Elasticsearch features instead of third-party tools.
Step-by-Step Fuzzy Search Setup
- Create the index with mappings for fields requiring fuzzy search.
- Choose an analyzer (standard, phonetic if needed).
- Use
multi_matchwithfuzziness: AUTOin queries. - Set
prefix_length: 2for performance. - Test on a sample of typical typos.
- Adjust parameters as needed.
What Our Work Includes
- Analysis of common typos and search patterns from your users.
- Index mapping configuration for fuzzy search (field selection, analyzers).
- Tuning fuzziness, prefix_length, max_expansions for your data.
- Performance optimization (profiling, shard settings).
- Testing on real query sets with adjustments.
- Documentation and access transfer.
- Training your team on fuzzy search usage.
Timelines and Cost
Basic setup (fuzziness + parameters) — 1 business day. If phonetic analysis or mixed Russian-English integration is needed, add 1 day. Cost is determined individually. Contact us — we'll assess your project for free. Get a consultation right now!
Our certified Elastic specialists (5+ years experience) have delivered over 20 fuzzy search projects in production. We guarantee: if the result doesn't satisfy you, we'll rework it at no extra charge.







