# Update items in a rolled-over index

**URL:** <https://discuss.elastic.co/t/update-items-in-a-rolled-over-index/265087>\
**Category:** Elasticsearch\
**Created:** [February 22, 2021, 3:18pm UTC](https://discuss.elastic.co/t/update-items-in-a-rolled-over-index/265087 "2021-02-22T15:18:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jorge\_Ruiz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jorge_ruiz/32/84323_2.png) [@Jorge\_Ruiz](https://discuss.elastic.co/u/Jorge_Ruiz)\
**Post date:** [February 22, 2021, 3:18pm UTC](https://discuss.elastic.co/t/update-items-in-a-rolled-over-index/265087/1 "2021-02-22T15:18:46Z")

</div>

Hi there! A quick and simple question related to rolled-over indexes.

Is it a good approach to have a rollover index if, eventually, we want to update items that belong to an already completed index (rolled-over)?

As far as I can see, you can update an item with a given existing ID (within a rolled-over index), but in that case, a new item will be created in the current "writing" index, ending up in having 2 items with the same ID in two different indexes (one rolled-over, one active).

Thanks!

---

<div class="post-metadata">

**Author:** ![Iker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iker/32/91708_2.png) [@Iker](https://discuss.elastic.co/u/Iker)\
**Post date:** [February 22, 2021, 4:35pm UTC](https://discuss.elastic.co/t/update-items-in-a-rolled-over-index/265087/2 "2021-02-22T16:35:26Z")

</div>

I don't think that you write a new document, only if you are indexing something new, if you are only using the update APIs, there's no duplicity at all, even by the index alias you could update the document without any trouble.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 22, 2021, 4:55pm UTC](https://discuss.elastic.co/t/update-items-in-a-rolled-over-index/265087/3 "2021-02-22T16:55:56Z")

</div>

> [@Iker](#):
>
> I don't think that you write a new document, only if you are indexing something new, if you are only using the update APIs, there's no duplicity at all, even by the index alias you could update the document without any trouble.

That is only correct as long as the document being updated is in the index currently being written to. If you try to update a document in a previously rolled over index you can not do so through the write alias but need to go directly to the correct index.

---

<div class="post-metadata">

**Author:** ![Iker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iker/32/91708_2.png) [@Iker](https://discuss.elastic.co/u/Iker)\
**Post date:** [February 22, 2021, 5:03pm UTC](https://discuss.elastic.co/t/update-items-in-a-rolled-over-index/265087/4 "2021-02-22T17:03:53Z")

</div>

Is that expected for 'update by query' with backing index for Data Streams as well?, cause I was under the impression that it never happen in the Data Streams Scenario. @Jorge_Ruiz Could you specify if you are using indexes or data streams?.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 22, 2021, 5:06pm UTC](https://discuss.elastic.co/t/update-items-in-a-rolled-over-index/265087/5 "2021-02-22T17:06:03Z")

</div>

Update-by-query works against all indices but can be quite expensive. Updates based on ID requires index to be specified.

---

<div class="post-metadata">

**Author:** ![Jorge\_Ruiz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jorge_ruiz/32/84323_2.png) [@Jorge\_Ruiz](https://discuss.elastic.co/u/Jorge_Ruiz)\
**Post date:** [February 22, 2021, 5:15pm UTC](https://discuss.elastic.co/t/update-items-in-a-rolled-over-index/265087/6 "2021-02-22T17:15:26Z")

</div>

I'm using indexes, not data streams. So, from your answer @Christian_Dahlqvist I guess I could update an element inside an index that has been already rolled-over, using the index name instead of the alias.

Thanks

---

<div class="post-metadata">

**Author:** ![Jorge\_Ruiz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jorge_ruiz/32/84323_2.png) [@Jorge\_Ruiz](https://discuss.elastic.co/u/Jorge_Ruiz)\
**Post date:** [February 23, 2021, 8:37am UTC](https://discuss.elastic.co/t/update-items-in-a-rolled-over-index/265087/7 "2021-02-23T08:37:51Z")

</div>

Ok, I did that and worked (I mean, update an element that is in a rolled-over index using the index name).

The question is, does it makes sense? Because I thought, the idea is that the rollover only points to one writing index, the others are not for writing... anyway, seems that they are.

The property `is_write_index` for all the indexes is `false` except for one (the active one), which is `true`. Why I am able to write in other indices? In other words, is correct to think in a rolled-over index to be changed eventually?

Thanks again

---

<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:** [March 23, 2021, 8:38am UTC](https://discuss.elastic.co/t/update-items-in-a-rolled-over-index/265087/8 "2021-03-23T08:38:15Z")

</div>

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