# Rollover Index Throws Exception

**URL:** <https://discuss.elastic.co/t/rollover-index-throws-exception/349687>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [December 20, 2023, 3:19am UTC](https://discuss.elastic.co/t/rollover-index-throws-exception/349687 "2023-12-20T03:19:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![krish1](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@krish1](https://discuss.elastic.co/u/krish1)\
**Post date:** [December 20, 2023, 3:19am UTC](https://discuss.elastic.co/t/rollover-index-throws-exception/349687/1 "2023-12-20T03:19:51Z")

</div>

I have an index which uses ILM. The index rolls over every week. We use Spring-data to read and write for Elasticsearch. My index just rolled over today and we are having trouble with writing to it. It fails with the following error. We write to the es alias and not to the index name since ILM takes care of index management

```auto
Processor.process:61 - error occurred while saving DTOs:
org.springframework.data.elasticsearch.RestStatusException: Elasticsearch exception [type=illegal_argument_exception, reason=alias [analytics_alias] has more than one index associated with it [analytics_index-000001, analytics_index-000002], can't execute a single index op]; nested exception is ElasticsearchStatusException[Elasticsearch exception [type=illegal_argument_exception, reason=alias [analytics_alias] has more than one index associated with it [analytics_index-000001, analytics_index-000002], can't execute a single index op]]

```

However if you look at the alias only 1 alias is `write` enabled

```auto
{
  "analytics_index-000001" : {
    "aliases" : {
      "analytics_alias" : {
        "is_write_index" : false
      }
    }
  },
  "analytics_index-000002" : {
    "aliases" : {
      "analytics_alias" : {
        "is_write_index" : true
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [January 13, 2024, 9:52am UTC](https://discuss.elastic.co/t/rollover-index-throws-exception/349687/2 "2024-01-13T09:52:04Z")

</div>

Hi,

Some operations, like the update API, are not supported on aliases that point to multiple indices, even if only one of them is the write index. This is because these operations internally perform a read before the write, and the read operation doesn't know which index to target.

If you're using the update API or any other API that doesn't support multi-index aliases, you'll need to target the specific index directly instead of the alias.

Regards

---

<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:** [February 10, 2024, 9:52am UTC](https://discuss.elastic.co/t/rollover-index-throws-exception/349687/3 "2024-02-10T09:52:20Z")

</div>

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