# Index Rollover alias

**URL:** <https://discuss.elastic.co/t/index-rollover-alias/189331>\
**Category:** Elasticsearch\
**Created:** [July 8, 2019, 11:00am UTC](https://discuss.elastic.co/t/index-rollover-alias/189331 "2019-07-08T11:00:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeterPain](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@PeterPain](https://discuss.elastic.co/u/PeterPain)\
**Post date:** [July 8, 2019, 11:00am UTC](https://discuss.elastic.co/t/index-rollover-alias/189331/1 "2019-07-08T11:00:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gbrown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gbrown/32/34482_2.png) [@gbrown](https://discuss.elastic.co/u/gbrown)\
**Post date:** [July 12, 2019, 10:02pm UTC](https://discuss.elastic.co/t/index-rollover-alias/189331/2 "2019-07-12T22:02:36Z")

</div>

> [@PeterPain](#):
>
> As far as i know the "rollover\_alias" has to be the same as the "alias" assigned to the Index is that correct ?

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

> [@PeterPain](#):
>
> 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.

There are multiple open issues on Github requesting this feature, so it's on our roadmap. [[1]](https://github.com/elastic/elasticsearch/issues/38454) [[2]](https://github.com/elastic/elasticsearch/issues/36627)

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](https://www.elastic.co/guide/en/elasticsearch/reference/7.2/indices-templates.html#multiple-templates) for more details.

---

<div class="post-metadata">

**Author:** ![PeterPain](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@PeterPain](https://discuss.elastic.co/u/PeterPain)\
**Post date:** [July 15, 2019, 9:03am UTC](https://discuss.elastic.co/t/index-rollover-alias/189331/3 "2019-07-15T09:03:33Z")

</div>

Hey Gordan,

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 12, 2019, 9:03am UTC](https://discuss.elastic.co/t/index-rollover-alias/189331/4 "2019-08-12T09:03:39Z")

</div>

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