# Can the index's roll alias be set dynamically？

**URL:** <https://discuss.elastic.co/t/can-the-indexs-roll-alias-be-set-dynamically/271748>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [April 30, 2021, 8:29am UTC](https://discuss.elastic.co/t/can-the-indexs-roll-alias-be-set-dynamically/271748 "2021-04-30T08:29:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktpktr0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ktpktr0/32/87157_2.png) [@ktpktr0](https://discuss.elastic.co/u/ktpktr0)\
**Post date:** [April 30, 2021, 8:29am UTC](https://discuss.elastic.co/t/can-the-indexs-roll-alias-be-set-dynamically/271748/1 "2021-04-30T08:29:51Z")

</div>

I use filebeat to add fields to dynamically generate indexes.

```auto
index => "%{[service]}-%{+YYYY.MM.dd}"

```

I configure the following index template to match the generated index

```auto
{
  "index_templates" : [
    {
      "name" : "pre-games",
      "index_template" : {
        "index_patterns" : [
          "*_room_pre*"
        ],
        "composed_of" : [
          "games-mappings",
          "pre-games-settings"
        ],
        "priority" : 112,
        "version" : 1
      }
    }
  ]
}

```

```auto
{
  "component_templates" : [
    {
      "name" : "pre-games-settings",
      "component_template" : {
        "template" : {
          "settings" : {
            "index" : {
              "lifecycle" : {
                "name" : "pre",
                "rollover_alias" : "*_room_pre*"
              },
              "routing" : {
                "allocation" : {
                  "require" : {
                    "box_type" : "hot"
                  }
                }
              },
              "number_of_shards" : "3",
              "number_of_replicas" : "1"
            }
          }
        },
        "version" : 1
      }
    }
  ]
}

```

When I configured the index lifecycle policy, I encountered a problem:  
Normally, an index corresponds to an alias, which should be at the beginning of the index name. But my index template generates index names of different businesses, such as mysql\_ room\_ pre-2020-04-28； tomcat\_ room\_ pre-2020-04-28。 If every business needs to generate an index template, then I

I've tried the following method to match index names of different businesses, but it doesn't work

```auto
"rollover_alias" : "*_room_pre*"

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 2, 2021, 9:57pm UTC](https://discuss.elastic.co/t/can-the-indexs-roll-alias-be-set-dynamically/271748/2 "2021-05-02T21:57:50Z")

</div>

AFAIK that is not currently supported with ILM, it's something that is being looked at.

---

<div class="post-metadata">

**Author:** ![ktpktr0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ktpktr0/32/87157_2.png) [@ktpktr0](https://discuss.elastic.co/u/ktpktr0)\
**Post date:** [May 3, 2021, 5:42am UTC](https://discuss.elastic.co/t/can-the-indexs-roll-alias-be-set-dynamically/271748/3 "2021-05-03T05:42:54Z")

</div>

OK, thank you

---

<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:** [May 31, 2021, 5:43am UTC](https://discuss.elastic.co/t/can-the-indexs-roll-alias-be-set-dynamically/271748/4 "2021-05-31T05:43:32Z")

</div>

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