I am having some problems implementing a feature in ES 2.4 that deletes and recreates an index that is currently in use, causing all kinds of weird race conditions and leaving the index in a corrupt and unusable state.
As a test environment I have a SOAP UI test suite that adds documents to the same index with random data constantly with 8 threads.
During this I call DELETE on the index which starts the delete process but fails halfway, probably because one of the concurrent ADD requests already started recreating the index. This leaves the index in an invalid state, giving an ElasticSearchException: "analyzer [western_europe] not found for field [sections]"
Preferably, I would like to be able to call the following:
- Tell the ES cluster to put index A in offline/maintenance mode
- Wait for all existing queries (read/write) to finish
- Delete the index
- Recreate the index with potential different mappings
- Bring the index online again.
I tried surrounding the DELETE and initialize with Open/close operations, but this does not seem to help.
Using the delete-by-query plugin for 2.4 (native supported in 5.0) is not an option, since I might need to change the mapping of existing fields in this operation which is not supported by ES and requiring a recreation of the index.