# Rollover API and upserts

**URL:** <https://discuss.elastic.co/t/rollover-api-and-upserts/124943>\
**Category:** Elasticsearch\
**Created:** [March 21, 2018, 9:22am UTC](https://discuss.elastic.co/t/rollover-api-and-upserts/124943 "2018-03-21T09:22:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)\
**Post date:** [March 21, 2018, 9:22am UTC](https://discuss.elastic.co/t/rollover-api-and-upserts/124943/1 "2018-03-21T09:22:51Z")

</div>

Hello, Do you confirm that doc\_as\_upsert is supported by the rollover API?

I mean if I follow [https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html:](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html:)

- I have a document A in logs-0001
- the current is logs-0099
- I use the upsert a doc against logs\_writer

is the result:

- if the doc does not exists, it is created in logs-0099
- if the doc exists (doc A), it is updated in its own index: logs-0001

---

<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:** [March 21, 2018, 9:24am UTC](https://discuss.elastic.co/t/rollover-api-and-upserts/124943/2 "2018-03-21T09:24:43Z")

</div>

> [@dao](#):
>
> if the doc exists (doc A), it is updated in its own index: logs-0001

No, it will be created in `logs-0099` if it can not be found there.

---

<div class="post-metadata">

**Author:** ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)\
**Post date:** [March 21, 2018, 9:25am UTC](https://discuss.elastic.co/t/rollover-api-and-upserts/124943/3 "2018-03-21T09:25:50Z")

</div>

OK, therefore rollover API cannot be used with upserts? confirmed?

---

<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:** [March 21, 2018, 9:26am UTC](https://discuss.elastic.co/t/rollover-api-and-upserts/124943/4 "2018-03-21T09:26:16Z")

</div>

It can be used, but it doesn't make as much sense.

---

<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:** [March 21, 2018, 9:27am UTC](https://discuss.elastic.co/t/rollover-api-and-upserts/124943/5 "2018-03-21T09:27:50Z")

</div>

Not easily, as you would need to look up which underlying index to update first. If the upset has access to the original timestamp of the event, a time-based index where each index corresponds to a fixed period might be better.

---

<div class="post-metadata">

**Author:** ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)\
**Post date:** [March 21, 2018, 9:42am UTC](https://discuss.elastic.co/t/rollover-api-and-upserts/124943/6 "2018-03-21T09:42:59Z")

</div>

OK thank's for this prompt answer. I would suggest to add a note in the documentation, in the rollover API and the upsert one

---

<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:** [April 18, 2018, 9:43am UTC](https://discuss.elastic.co/t/rollover-api-and-upserts/124943/7 "2018-04-18T09:43:20Z")

</div>

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