# 2 aliases (read, write) per index pattern with rollover

**URL:** <https://discuss.elastic.co/t/2-aliases-read-write-per-index-pattern-with-rollover/370474>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [November 13, 2024, 11:23am UTC](https://discuss.elastic.co/t/2-aliases-read-write-per-index-pattern-with-rollover/370474 "2024-11-13T11:23:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RMII](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rmii/32/139187_2.png) [@RMII](https://discuss.elastic.co/u/RMII)\
**Post date:** [November 13, 2024, 11:23am UTC](https://discuss.elastic.co/t/2-aliases-read-write-per-index-pattern-with-rollover/370474/1 "2024-11-13T11:23:41Z")

</div>

Hello hello, good morning and happy Wednesday!

May I ask your help and also if this is a common/known issue?

This is a production cluster, ES 8.8.0. I am doing tests with a 5min rollover.

Due to the nature of our application we need 2 aliases per index pattern:  
$indexName\_read  
$indexName\_write

The rollover fails, and to make it work we need to remove the aliases from the index\_template (both of them). Then, the rollover works, the new index is created ONLY with the alias: "%indexName\_write".

I came to the understanding that I need to manually add the other alias "$indexName\_read" to the new index, is that the only solution? If yes, any suggestion on how to do it or will I have to add it as a feature to my application?

My lead index:

```auto
PUT rome_index-000001
{
  "aliases": {
    "rome_alias_read": {},
    "rome_alias_write": {
      "is_write_index": true
    }
  }
}

```

My index\_template:

```auto
PUT _index_template/rome_template
{
  "index_patterns": ["rome_index-*"],
  "template": {
    "settings": {
      "index.lifecycle.name": "rome_ilm",
      "index.lifecycle.rollover_alias": "rome_alias_write",
      "number_of_shards": 3,
      "number_of_replicas": 1
    },
    "aliases": {
      "rome_alias_read": {},
      "rome_alias_write": {
        "is_write_index": true
      }
    }
  }
}

```

My ILM:

```auto
PUT _ilm/policy/rome_ilm
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_age": "5m"
          },
          "set_priority": {
            "priority": 100
          }
        }
      }
    }
  }
}

```

Rollover error:

```auto
"reason": "Rollover alias [rome_alias_write] can point to multiple indices, found duplicated alias [[rome_alias_write, rome_alias_read]] in index template [rome_template]"

```

This is the original topic I found, but without an apparent solution:

> [@2 aliases to 1 index with rollover](https://discuss.elastic.co/t/2-aliases-to-1-index-with-rollover/321313):
>
> Hi, I want to define two aliases to index with rollover. I have set the following: PUT \_ilm/policy/policy1 { "policy": { "phases": { "hot": { "actions": { "rollover": { "max\_primary\_shard\_size": "40gb" } } }, "delete": { "min\_age": "7d", "actions": { "delete": {} } } } } } POST \_aliases { "actions": [ { "add": { "index": "index1-2022.10.18-000001", …
