# Modify documents of a datastream index

**URL:** <https://discuss.elastic.co/t/modify-documents-of-a-datastream-index/271490>\
**Category:** Elasticsearch\
**Tags:** datastreams\
**Created:** [April 28, 2021, 9:28am UTC](https://discuss.elastic.co/t/modify-documents-of-a-datastream-index/271490 "2021-04-28T09:28:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reggaeny](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@Reggaeny](https://discuss.elastic.co/u/Reggaeny)\
**Post date:** [April 28, 2021, 9:28am UTC](https://discuss.elastic.co/t/modify-documents-of-a-datastream-index/271490/1 "2021-04-28T09:28:12Z")

</div>

Coming from classic SQL and NoSql databases, I thought it must be possible to change documents in Elasticsearch datastream indexes. The first attempt via update\_by\_query (REST-Api) worked in the test but not in productive operation (relatively high change rate. \> 10 changes / sec). The next attempt to control the requests via a MessageBroker and a queue with prefetch=1 (only one request at a time) worked better, but also failed with high transaction rates. The attempt to delete the existing document (delete\_by\_query) and to create a new one in the changed version worked better again, but not without problems.

It seems to me that it is impossible to reliably change documents in Elasticsearch Datastreams.

Translated with [www.DeepL.com/Translator](http://www.DeepL.com/Translator) (free version)

---

<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:** [April 29, 2021, 12:12am UTC](https://discuss.elastic.co/t/modify-documents-of-a-datastream-index/271490/2 "2021-04-29T00:12:37Z")

</div>

Welcome to our community! 😃

> [@Reggaeny](#):
>
> It seems to me that it is impossible to reliably change documents in Elasticsearch Datastreams.

From [the docs](https://www.elastic.co/guide/en/elasticsearch/reference/7.12/data-streams.html) (emphasis mine);

> A data stream lets you store **append-only** time series data across multiple indices while giving you a single named resource for requests. Data streams are well-suited for logs, events, metrics, and other continuously generated data.

I would suggest you may want to rethink your approach. So what exactly are you trying to do, we may be able to offer alternatives if we better understand your use case.

---

<div class="post-metadata">

**Author:** ![Reggaeny](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@Reggaeny](https://discuss.elastic.co/u/Reggaeny)\
**Post date:** [April 29, 2021, 11:22am UTC](https://discuss.elastic.co/t/modify-documents-of-a-datastream-index/271490/3 "2021-04-29T11:22:40Z")

</div>

Thx for the prompt response.  
From the docs I got the following Information (Elasticsearch 7.12.) - see the enclosed screenshot.

 ![Bildschirmfoto 2021-04-29 um 13.20.21](https://us1.discourse-cdn.com/elastic/original/3X/0/3/03ff1dbd98689889a3589a25e690226befcf996f.png)

So I thought it would be possible to have Documents with a status field which changes whenever the document gets another status ( e. g. new, checked-out, checked-in, available etc).

---

<div class="post-metadata">

**Author:** ![Reggaeny](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@Reggaeny](https://discuss.elastic.co/u/Reggaeny)\
**Post date:** [May 3, 2021, 10:42am UTC](https://discuss.elastic.co/t/modify-documents-of-a-datastream-index/271490/4 "2021-05-03T10:42:22Z")

</div>

Sometimes it really helps to read the docs carefully 🙄  
If I do the expected document updates on the backing indexes of the data-stream using the Index-API everything works like a charm.

---

<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 3, 2021, 10:47pm UTC](https://discuss.elastic.co/t/modify-documents-of-a-datastream-index/271490/5 "2021-05-03T22:47:45Z")

</div>

No worries, I appreciate that sometimes it can be confusing.

---

<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, 10:48pm UTC](https://discuss.elastic.co/t/modify-documents-of-a-datastream-index/271490/6 "2021-05-31T22:48:37Z")

</div>

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