I am working on a java app to create an elasticSearch Index. The index is currently built on a dev machine on a weekly basis and the cluster manually copied over the existing cluster on other (test & prod) machines. The new scenario still involves rebuilding the index from scratch each week.
I am working on an update using 5.6.3 and the low & high level rest clients. After some initial investigations (and getting quite a bit of help) I am aiming to go for a 2 (or 3) stage development using aliases.
Initially I will alias the existing index(es) on dev, write all new data to the alias and then replace the index with the alias. The other alternatives to this that I could think of were
Recreating the cluster each time, which I thought would always be a fairly manual process, or
Recreating the indexes and moving them over. As indexes can't be renamed (or so I believe, this would always be more clunky as it would involve creating the indexes on one machine, deleting them from the live machine and then reading them. Currently we have one node in the cluster and so this would involve a fair amount of down time (although if the aliases turn out to be a bad solution I guess we could add another node and replace the index one node at a time).
so I have opted for
- using aliases. This way I can start by just recreating the index and copying it over (phase 1) and then move to a more sophisticated solution to restore the data programmatically & without bringing down elasticSearch (phase 3 is the dream of just updating the index if we ever get our data sorted properly!)
So down to the question. I really would like to create an empty alias of the index straight off. As far as I can see this is not possible. Among other pages this github issue., although from an older version, makes it appear that a move like this would be counter-productive and is not something elastic want to introduce. So I was just wondering if
- I am looking at the wrong design entirely or
- there is now a way to create an empty alias or
- whether I should create an alias and then delete all documents from the alias instead ?