Zero Downtime Reindexing & Unblocking in Elasticsearch
This is Part 6 of the "Building a Scalable, Faceted Online Marketplace" series. Read the Introduction here.
Why Zero Downtime Reindexing?
As your marketplace grows, you'll need to update mappings, add fields, or optimize your Elasticsearch indices. But how do you do this without taking your search offline? Enter zero-downtime reindexing and index unblocking.
The Tools: zero_downtime_reindex.js
& unblock_index.js
- Clone and reindex your live index to a new one
- Switch aliases atomically to cut over with zero downtime
- Unblock a read-only index (e.g., after disk watermark issues)
Key Features
- Safe Reindexing: No lost queries, no downtime
- Alias Switching: Instantly swap old and new indices
- Unblock Utility: Quickly clear read-only status
Example Usage
node tools/zero_downtime_reindex.js --src products --dest products_v2 --es http://localhost:9200
node tools/unblock_index.js --index products --es http://localhost:9200
Real-World Tips
- Always test reindexing on a staging cluster first
- Monitor cluster health and alias status
- Use aliases for all production indices
Next up: Frontend: Meesho-Style Faceted Search UI in React
In the next article, we'll build a beautiful, responsive React UI for faceted search, just like Meesho or Amazon!