Home > Blockchain >  What happens if I write data to an Elasticsearch index when an reindex is occuring
What happens if I write data to an Elasticsearch index when an reindex is occuring

Time:06-29

Lets say I'm copying data from index A to index B via Elasticsearch's Reindex API and the reindex operation takes 5 minutes. If during this 5 minute window I write a new document into index A. Will that document be copied as part of the reindex operation?

CodePudding user response:

The short answer is NO.

The first time you run reindex operation ES will create a PIT(Point in time) and will move all documents until that time to the new index. To solve the problem you can flag new documents with specific property and then reindex them to the new index.

The better solution would be to use zero-downtime reindex approach using aliases for this approach you would create read and write alises you will write to the new index and read from both indices and then you can use clopse operation to filter result that are already indexed. For more information you can check this blog post here.

  • Related