Elasticsearch Fuzzy Search: Taming Typos with Fuzziness

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) neede

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1419
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1287
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    983
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1244
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    983
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    998

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

  1. Create the index with mappings for fields requiring fuzzy search.
  2. Choose an analyzer (standard, phonetic if needed).
  3. Use multi_match with fuzziness: AUTO in queries.
  4. Set prefix_length: 2 for performance.
  5. Test on a sample of typical typos.
  6. 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.