# Create or Update a document

**URL:** <https://discuss.elastic.co/t/create-or-update-a-document/93211>\
**Category:** Elasticsearch\
**Created:** [July 14, 2017, 3:20pm UTC](https://discuss.elastic.co/t/create-or-update-a-document/93211 "2017-07-14T15:20:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobinFrcd](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@RobinFrcd](https://discuss.elastic.co/u/RobinFrcd)\
**Post date:** [July 14, 2017, 3:20pm UTC](https://discuss.elastic.co/t/create-or-update-a-document/93211/1 "2017-07-14T15:20:06Z")

</div>

Hi,  
I'm currently using a 2.4 ES index, and I have to update or add documents everyday. Currently, the index is deleted and remade everyday and I think that's not the best choice here ...

So is there a function which could help me here ? All my documents have a specific ID (different from the one givent by ES), and I would like to create a document if the corresponding ID doesn't exist yet or update the document.

PS: I'm using ES in a Python project, so I'm currently using the ES python package.

Thanks,  
Robin

---

<div class="post-metadata">

**Author:** ![pts0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pts0/32/17811_2.png) [@pts0](https://discuss.elastic.co/u/pts0)\
**Post date:** [July 14, 2017, 3:40pm UTC](https://discuss.elastic.co/t/create-or-update-a-document/93211/2 "2017-07-14T15:40:46Z")

</div>

Hi,

Is suppose you are looking for

[https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#upserts](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#upserts)

---

<div class="post-metadata">

**Author:** ![RobinFrcd](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@RobinFrcd](https://discuss.elastic.co/u/RobinFrcd)\
**Post date:** [July 16, 2017, 9:53am UTC](https://discuss.elastic.co/t/create-or-update-a-document/93211/3 "2017-07-16T09:53:56Z")

</div>

Perfect, thank you ! Upserts, that was exactly the word I needed !

---

<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:** [August 13, 2017, 9:54am UTC](https://discuss.elastic.co/t/create-or-update-a-document/93211/4 "2017-08-13T09:54:08Z")

</div>

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