Quick revision
The short answer
I would stay with MySQL FULLTEXT while search is simple, the data is moderate and consistency with transactions matters, because it needs no second system. Once the product truly needs typo tolerance, synonyms, facets, relevance tuning and per-language analysis, those are a search engine's strengths, and I would move to Elasticsearch or OpenSearch, accepting an indexing pipeline, eventual consistency and extra operations, after prototyping relevance on real queries.
What to remember
In this answer, we saw that InnoDB FULLTEXT offers natural language and boolean modes with limited ranking, a minimum token size, stop words and an ngram parser for CJK, but no typo tolerance, synonyms, stemming or efficient facets. Staying in MySQL keeps search consistent with transactions and avoids a second system, which suits simple search on moderate data. Moving to Elasticsearch or OpenSearch brings those features but adds an outbox or CDC pipeline, reindexing, eventual consistency and operations work, so we decide by feature needs, query volume and team capacity, after prototyping relevance on real queries.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would stay with MySQL FULLTEXT while search is simple, the data is moderate and consistency with transactions matters, because it needs no second system. Once the product truly needs typo tolerance, synonyms, facets, relevance tuning and per-language analysis, those are a search engine's strengths, and I would move to Elasticsearch or OpenSearch, accepting an indexing pipeline, eventual consistency and extra operations, after prototyping relevance on real queries.
Why this question is asked
Search requirements tend to grow in steps. First it is "find products by name", then "it should forgive typos", then "show the brand and size filters with counts". At some point the database's built-in search stops stretching, and the question is whether moving is worth what it costs. Interviewers ask this scenario to see whether we know the actual limits of MySQL's full-text search and the actual costs of a search engine, rather than assuming the bigger tool is always better. In this answer, we will recap what InnoDB FULLTEXT does, check each requested feature against it, look at what a move really involves, and set out how I would decide.
1A Quick Recap of InnoDB FULLTEXT
InnoDB supports FULLTEXT indexes on CHAR, VARCHAR and TEXT columns. We query them with MATCH(columns) AGAINST(text) in one of three modes. Natural language mode, the default, returns rows ordered by a relevance score based on how often words occur in the row and how rare they are in the whole table. Boolean mode lets the user require (+), exclude (-) or prefix-match (*) words, but does not sort by relevance automatically. Query expansion runs the search twice, adding words from the best results, which can help short queries and often adds noise.
There are limits worth knowing. Words shorter than innodb_ft_min_token_size, 3 by default, are not indexed, so a search for "tv" finds nothing unless we lower the setting and rebuild the index. A built-in stop word list drops common words. There is no stemming, so "shoes" does not match "shoe". For Chinese, Japanese and Korean text, which has no spaces between words, the ngram parser splits text into fixed-length pieces instead.
2Checking Each Requested Feature
Now we can check what the product asked for. Typo tolerance does not exist in FULLTEXT; the closest workaround is a hand-built list of corrections or a separate n-gram index, both of which are fragile. Synonyms are not supported either; we would have to rewrite queries in the application, for example expanding "sofa" into "sofa couch". Facets, the filter counts such as "Brand: Nike (42)", can be computed with GROUP BY queries, but each facet is another query over the matching rows, which gets expensive when a search matches 100,000 products. Per-language stemming is missing entirely, apart from the ngram parser for CJK.
A search engine such as Elasticsearch or OpenSearch does all four as core features: fuzzy queries with an edit distance, synonym filters managed as configuration, aggregations that return facet counts in the same request, and analyzers per language with stemmers. It also lets us tune relevance with boosts and function scores, which MySQL's fixed scoring does not allow.
| Feature | MySQL FULLTEXT | Elasticsearch or OpenSearch |
|---|---|---|
| Typo tolerance | not supported | fuzzy queries, edit distance |
| Synonyms | rewrite queries in the app | synonym filters in the analyzer |
| Facets with counts | extra GROUP BY per facet | aggregations in the same request |
| Per-language stemming | none (ngram for CJK) | language analyzers |
| Relevance tuning | fixed scoring | boosts, function scores |
| Consistency with orders | same transaction | eventual, after indexing |
3What Staying in the Database Gives Us
Staying has real advantages that are easy to dismiss. The index is updated in the same transaction as the product row, so a price change or a deleted product is reflected at commit, with no lag. There is no second cluster to run, secure, upgrade and pay for, and no pipeline that can fall behind. For a catalogue of tens of thousands of products and a few searches per second, FULLTEXT plus a little application logic is often good enough, and the team spends its time elsewhere.
4What Moving Really Involves
Moving adds a second system, and the cost lives mostly in the parts around it. We need an indexing pipeline that copies every product change into the search engine. A transactional outbox, a table written in the same transaction as the product change and read by a relay, or change data capture (CDC) with a tool such as Debezium reading the MySQL binary log, are the reliable ways; writing to MySQL and then to Elasticsearch from the same request loses updates when the second write fails.
6 messages in order. Play them, or step through them one at a time.
Search becomes eventually consistent; prices for checkout still come from MySQL.
We also need a way to rebuild the whole index from MySQL, for mapping changes and disasters, usually by building a new index in the background and switching an alias to it. Search becomes eventually consistent: a product saved a second ago may not appear yet, which the product team has to accept for search but not for checkout, which still reads MySQL. And someone has to operate the cluster: heap sizing, shard counts, upgrades and monitoring.
5How I Would Decide
I would decide on three things: feature needs, query volume and team capacity. If only one of the requests matters, say synonyms for a hundred known terms, a query rewrite in the application keeps us in MySQL. If typo tolerance, facets and several languages all matter, a search engine is the honest answer. High query volume on a primary that also takes orders is another push to move search off it.
Before committing, I would prototype relevance on real queries. We take the top few hundred search terms from the logs plus the queries that returned nothing, run them against MySQL and against a prototype index, and have product people judge the top results. That turns "Elasticsearch is better" into a measured improvement, and if the prototype wins, we also learn which analyzer and synonym settings to ship. And I would check that the team can run the cluster, or budget for a managed service.
6Follow-up questions
Could we use a managed search service to reduce the operations cost?
Yes, a managed OpenSearch or Elasticsearch service removes most of the cluster work, though not the indexing pipeline, reindexing or eventual consistency. It moves cost from people time to the bill, which is often the right trade for a small team.
Why not write to MySQL and Elasticsearch in the same request?
Because the two writes are not atomic. If the second one fails or the process dies between them, search shows stale data forever. An outbox or CDC makes the copy reliable and retryable.
Would PostgreSQL full-text search change the answer?
Partly. PostgreSQL adds stemming per language and pg_trgm for typo matching, so it stretches further than MySQL. Synonym management, facets at scale and relevance tuning would still favour a search engine.
7Conclusion
In this answer, we saw that InnoDB FULLTEXT offers natural language and boolean modes with limited ranking, a minimum token size, stop words and an ngram parser for CJK, but no typo tolerance, synonyms, stemming or efficient facets. Staying in MySQL keeps search consistent with transactions and avoids a second system, which suits simple search on moderate data. Moving to Elasticsearch or OpenSearch brings those features but adds an outbox or CDC pipeline, reindexing, eventual consistency and operations work, so we decide by feature needs, query volume and team capacity, after prototyping relevance on real queries.
Open with
I would first be clear about what MySQL FULLTEXT can do. It has natural language mode with a relevance score, boolean mode with plus, minus and prefix operators, a minimum token size of three by default, a stop word list, and an ngram parser for CJK.
Then, if they want more
It has no stemming, no typo tolerance and no synonyms, and facets mean extra GROUP BY queries. The big advantage of staying is that the index is updated in the same transaction as the product, there is no second system and no sync pipeline, which is fine for simple search on moderate data.
The four requested features, typo tolerance, synonyms, facets and per-language analysis, are exactly what a search engine like Elasticsearch or OpenSearch does well, along with relevance tuning.
But moving has a cost: an indexing pipeline through a transactional outbox or CDC with Debezium, a way to rebuild the index and switch aliases, eventual consistency that the product has to accept, and a cluster to operate. So I decide on feature needs, query volume and team capacity.
If only synonyms for a few terms matter, I rewrite queries in the app and stay. If several of these features matter, I prototype on the top real queries and the zero-result ones, have product judge the results, and move if the prototype clearly wins.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- PostgreSQL documentation, The SQL Language
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Search in your Spring Boot shop uses MySQL FULLTEXT indexes. Product wants typo...": https://scrivio-interview-library.netlify.app/databases/advanced-sql/b7dba4e025/