I’m trying to create a flow for updating an ElasticSearch alias with a new index that has different properties with zero downtime.
Here is my current flow.
- Create New Index
- Add new index to alias and set it as the write index
- Reindex existing index to new index
- Delete the Old Index
The issue I’m running into is that this index is 8 million documents and the reindex process takes awhile. In the meantime the number of documents on the alias is doubling and search results are showing double. These are the options I’ve thought of and the reason I don’t see them as solutions.
Reindex the new index before I add it to the alias: This doesn’t work because entries will be written to the existing index while the reindexing process is taking place.
Remove the existing index from the alias when I add the new index and then execute the reindex process: This doesn’t work because search results won’t show up if someone does a search.
Add the new index to the alias and set it to the write_index Then execute the reindex process: This doesn’t work because the documents are now duplicated until the existing index is removed from the alias after the reindexing process completes.
Any guidance would be appreciated.