Automatically creating index versions and alias

(Marcelo Gornstein) #1


As described here in Index Aliases and Zero Downtime, we're creating our indices in the form "thing-2015_08_v1" and then we access them through an alias like "thing-2015_08", so we can later on reindex or have room to apply any needed improvements by just pointing the alias to a different index version.

Currently, we also use index templates so a missing index is created automatically when it doesn't exist. This is working flawlessly.

The question is about what would be the best way to actually have ES create the index with the suffix _v1 and at the same time the new alias pointing to it. Using an index template will automagically create thing-2015_08 but not thing_2015_08_v1 (since all our queries use the former and not the latter).

Our "poor man's solution" is a cron job that runs every 28th day of the month to create thing_2015_08_v1 and setup the alias thing_2015_08 pointing to it, so it is ready for the next month.

So: is there any solution already built in in ES itself for this?

Thanks in advance!

(system) #2