From MySQL to Search
Separating operational data from search by extracting and indexing it into Elasticsearch.
The Problem
The product’s operational data already lived in MySQL, but search required a different querying model. As retrieval needs grew, relying on the transactional database for search would make both responsibilities harder to manage efficiently.
The Constraint
Keep MySQL as Source
Optimize for Retrieval
Data Freshness
The operational database needed to remain the source of truth for product data.
Search needed its own structure and indexing behaviour, independent from transactional queries.
The search index needed to stay sufficiently synchronized with changes in MySQL.
- Keep MySQL as SourceThe operational database needed to remain the source of truth for product data.
- Optimize for RetrievalSearch needed its own structure and indexing behaviour, independent from transactional queries.
- Data FreshnessThe search index needed to stay sufficiently synchronized with changes in MySQL.
Decision Rationale
Why We Chose The Approach
The Result
Search became a dedicated system concern without adding retrieval pressure to the transactional database.
In Retrospect
If I were revisiting this architecture, I’d focus on three questions:
- How fresh does the search index need to be?
- What happens when indexing fails or falls behind?
- How do we detect drift between MySQL and Elasticsearch?