lets say I have an actual, real index pattern foo-*. then i create another real index pattern v2-foo-*. now i create an alias that looks something like this: { "actions": [ { "add": { "index": "v2-foo-*", "alias": "foo-*" } } ] }
Lets just say that the pattern invoked by -* is simply a pattern for the date (eg, 2015.12.04).
So say I have these two sets of indexes: foo-2015.12.01 foo-2015.12.02 foo-2015.12.03 foo-2015.12.04
Now, I want to be able to delete all of the old foo-* indices. Is there anyway of doing this, other than having to reference each one of them individually?
curl -XDELETE 'localhost:9200/foo-*' should do it though I tend to not use wildcards in deletes because I fear mistyping things. I suggest full paranoia: test it locally before you run it on real stuff. Make sure it only deletes what you want and then copy the command where you want to run it.
think there might be confusion here. as I have pointed out, foo-* is aliased to v2-foo-*.. so running DELETE foo-* deletes all v2-foo-* indices. I just tested it.
@dadoonet, I dunno if its ok that we resolve the DELETEs through the aliases. That seems a bit too much.
@treehouse, I'd just delete each index individually. I'd pretty much do that all the time anyway, but I'd certainly do that given when you've mentioned here.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.