Elasticsearch related rake tasks should work with aliases to index, not the actual index.
Next time, when the index rebuild is needed we need to create an alias gitlab-production
to index gitlab-production-v1
. It will allow us to be flexible while it costs nothing for us. The problem is that an index can not be renamed in ES easily. We might need zero downtime migrations in the future so we should be prepared to that. Moreover, using aliases instead of actual indexes is one of the best practics.
/cc @nick.thomas
REFERENCES:
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
https://www.elastic.co/blog/changing-mapping-with-zero-downtime