Correct way to use aliases?

I am trying to improve the way I manage my indexes in Elasticsearch and am considering using aliases. But I want to make sure I understand the pattern properly. Right now I have some indexes that are grouped by year, and some that are standalone. Like this:

  • works-v9-2000
  • works-v9-2001
  • works-v9-2002
  • concepts-v6

My production app and logstash point to works like works-v9-, and to concepts like concepts-v6. When I need to adjust fields and reindex, I simply increase the version number in my template and reindex. So I end up with works-v10-. Then I point my development app at the next version and test it out. So I would point to works-v10* to see if everything is good.

So how I can adjust this to use aliases? What I am thinking is something like this:

  • Production indexes use regular alias like works and concepts
  • My next index template has an alias set to the version, such as works-v10
  • I do the reindex and point my app at the alias works-v10 to test it out.
  • I run a single command in dev tools that switches works-v9-* to point to alias works-v9, and make works-v10 point to works
  • logstash ingest always points to the alias works so I don't need to touch it
  • Once everything is good I close and delete works-v9-*

Am I thinking about this correctly? Any tips or tricks I should be aware of?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.