ElasticSearch: Zero downtime reindexing

When you need to reindex your data, a new index is created, the write alias points to the new index and read alias points to the old index..After writing all data into the new index, read index will also point to the new index and finally delete the old index.Option 3: Similar to option 2, this approach also utilises two aliases..However, the main difference is that when the new index is created, the read alias points both the old and the new indices..The drawback of this approach is that your application has to deal with duplicate documents in the search result.Zero-downtime reindexing using aliasesFor this blog post, I have chosen option 2..This method covers most of the aspects of the zero downtime reindexing..One downside of this strategy is that newly created, updated, or deleted documents write only the new index during the reindexing process..This means your application searches could see stale data during this time and new data will not show up until the reindexing is completed..If your business can not afford this, option 3 might be the right solution.An example Laravel application has been set up to guide through the whole process of the zero downtime reindexing..The example app is only for the demonstration purpose..The production code needs to handle many edge cases such as handling errors..For data, we are going to use MySQL world database..This database has three tables: country, city and countrylanguage.There are six stages to reindexing:Step1: Create an index like world_1544094130 with a timestamp appended.. More details

Leave a Reply