Replace index alias when a new index created

hello All,

we create indices based on index templates, where corresponding aliases are configured, e.g.:

  "order": 0,
  "version": 1,
  "index_patterns": [
  "aliases": {
    "docs-app" : {}
    "mappings" : {

For example, I'm creating an index:

PUT docs-app-v1

and it'll get the alias docs-app.
Now, I'd like to create a new version of the index:

PUT docs-app-v2

and I'd like the alias docs-app to point to the new one only, instead of pointing to both, which is current behavior.
Is it possible? If I'm not mistaken, ILM would not help in such case, as there are no age- or size-related conditions.


I guess this is what you are looking for

curl -X POST "localhost:9200/_aliases?pretty" -H 'Content-Type: application/json' -d'
    "actions" : [
        { "remove" : { "index" : "docs-app-v1", "alias" : "docs-app" } },
        { "add" : { "index" : "docs-app-v2", "alias" : "docs-app" } }

not really, I'd like the alias to get replaced automatically, as soon as a new index, based on the same template, gets created (docs-app-v2 in the case above).

Oh, hmm... Ok, there I don't know the solution (if there's one) :confused:

I thought, there might be a magic parameter for the aliases config:

  "aliases": {
    "docs-app" : { "MAGIC_PARAMETER_replace_existing": true}


1 Like

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