Member-only story
How I Reindex Elasticsearch Without Downtime

Elasticsearch (ES) is a powerful, flexible, and scalable search engine. It stores data as key-value pairs in a document. It groups many documents to form an index. Under the hood, ES uses an inverted index data structure, which allows us to query documents by the fields they contain.

Usually, you should not use ES as your primary data store. Data should still be stored in a persistent database like MySQL. You have to write code to sync data between your data store and the ES cluster.
Keeping data consistent is a challenge. As business evolves, you might need to update the mappings of existing fields in your index. Or, there could be many dirty data in your index due to unexpected errors during data sync.
In both cases, you find a need to rebuild your ES index from scratch. This is known as reindexing.
In this article, I will share with you how I perform ES reindexing without downtime. We will go through the design ideas and some important ES concepts. Let’s get started! 🏃