# How not to get double entries in my datastream using the Index API

**URL:** <https://discuss.elastic.co/t/how-not-to-get-double-entries-in-my-datastream-using-the-index-api/254015>\
**Category:** Elasticsearch\
**Created:** [November 2, 2020, 10:53am UTC](https://discuss.elastic.co/t/how-not-to-get-double-entries-in-my-datastream-using-the-index-api/254015 "2020-11-02T10:53:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hugohendriks](https://avatars.discourse-cdn.com/v4/letter/h/a6a055/32.png) [@hugohendriks](https://discuss.elastic.co/u/hugohendriks)\
**Post date:** [November 2, 2020, 10:53am UTC](https://discuss.elastic.co/t/how-not-to-get-double-entries-in-my-datastream-using-the-index-api/254015/1 "2020-11-02T10:53:45Z")

</div>

Hi,

We are using the Index API to post data to my datastream. I read from a queue and then perform a POST but I do have a timeout setting of 10 seconds. What sometimes happens it seems is that elastic takes more then 10 seconds so I throw a timeout on the connection and rollback to the queue. When I then retry I get a double entry as the first call probably went through but it took longer then 10 seconds. I thought I could change this perhaps by not using POST but using a PUT and supplying the doc id so I would create an UPSERT and prevent double entries but you can't update in a data stream. I can make the timeout setting higher but I don't want to go too high as this might cause stuck threads. Any ideas for this?

best regards,  
Hugo

---

<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:** [November 30, 2020, 10:53am UTC](https://discuss.elastic.co/t/how-not-to-get-double-entries-in-my-datastream-using-the-index-api/254015/2 "2020-11-30T10:53:49Z")

</div>

Closed on November 30, 2020, 10:53am UTC

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