Better Programming

Advice for programmers.

Follow publication

Member-only story

How I Reindex Elasticsearch Without Downtime

Jonathan Seow
Better Programming
Published in
8 min readFeb 7, 2022
Photo by Markus Winkler on Unsplash

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.

You know, for search!

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! 🏃

System Overview

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Jonathan Seow
Jonathan Seow

Written by Jonathan Seow

Software Engineer @ TikTok I also share byte-sized coding insights on my blog! https://www.thebytearray.com/

No responses yet

Write a response