Index Rollover alias

Hey there im testing arround with the Index Lifecycle Management and have some problems with it which i don't know how to handle them.

I have a Template to assing the ILM-Policy, which are for multiple Indices.

PUT _template/pms_test_netzwerk
{
    "order" : 0,
    "index_patterns" : [
      "pms_netzwerk_monti1*"
    ],
    "settings" : {
      "index" : {
        "lifecycle" : {
          "name" : "pms_test",
          "rollover_alias" : "pms_netzwerk_monti1"
        },
        "codec" : "best_compression",
        "refresh_interval" : "5s",
        "number_of_shards" : "1"
      }
    },
    "mappings" : {
      "properties" : {
        "Station" : {
          "type" : "keyword"
        },
        "Bereich" : {
          "type" : "keyword"
        },
        "techn_Platz" : {
          "type" : "keyword"
        },
        "Anlage" : {
          "type" : "keyword"
        }
      }
    },
    "aliases" : { }
  }

And this is my Index i created

PUT /%3Cpms_test_netzwerk_monti1-%7Bnow%2FM%7Byyyy.MM%7D%7D-0001%3E
{
  "aliases": {
    "pms_netzwerk_monti1": {
      "is_write_index": true
    }
  }

As far as i know the "rollover_alias" has to be the same as the "alias" assigned to the Index is that correct ?

When they are not the same i get the following error-message

index.lifecycle.rollover_alias [pms_netzwerk_monti1] does not point to index [pms_netzwerk_monti1-2019.07-0001]

So my question. Is it possible to assign the rollover alias with a template snippet like so ?

"rollover_alias" : "pms_netzwerk_{my_field}"

Because i have more indices with differnt names and i need different alias for each index.

This is correct. The setting index.lifecycle.rollover_alias must be an alias that can be used to write to that index.

There are multiple open issues on Github requesting this feature, so it's on our roadmap. [1] [2]

In the meantime, if you want to use the same template for multiple indices with different aliases, you can have one primary template that's shared, and use another template that has only the index.lifecycle.rollover_alias setting in it that's specific to each index, and use the order parameter to make sure the templates are merged correctly. See the docs on multiple templates for more details.

Hey Gordan,

thanks alot for your response and the information.
Now im using one template for each index which works fine for me.

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