# Create vs Update

**URL:** <https://discuss.elastic.co/t/create-vs-update/83673>\
**Category:** Elasticsearch\
**Created:** [April 26, 2017, 10:08am UTC](https://discuss.elastic.co/t/create-vs-update/83673 "2017-04-26T10:08:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Davidovich](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@Alex\_Davidovich](https://discuss.elastic.co/u/Alex_Davidovich)\
**Post date:** [April 26, 2017, 10:08am UTC](https://discuss.elastic.co/t/create-vs-update/83673/1 "2017-04-26T10:08:35Z")

</div>

Hello,

I want to understand the differences in performance between update and create.  
I have a document that could be updated up to 4 times in my system. Is it making more sense  
to only create new documents with a property that is responsible for letting me know which document is the most up to date?  
Or should I just update 4 times? Asking from a performance perspective.  
I only update 1 field in these 4 updates so this will be a partial update and not a whole document update.  
In addition, Elasticsearch is NRT and my refresh interval is less 1 second. Can I update a document less than  
1 second after I inserted it? Will it change the document in memory and store only the updated in the disk?

Thanks

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [April 26, 2017, 2:51pm UTC](https://discuss.elastic.co/t/create-vs-update/83673/2 "2017-04-26T14:51:51Z")

</div>

> [@Alex\_Davidovich](#):
>
> I only update 1 field in these 4 updates so this will be a partial update and not a whole document update.

This doesn't really matter. An update means marking the old document as deleted and indexing the document fresh.

> [@Alex\_Davidovich](#):
>
> In addition, Elasticsearch is NRT and my refresh interval is less 1 second. Can I update a document less than 1 second after I inserted it? Will it change the document in memory and store only the updated in the disk?

Updates are consistent though updating a document before it has been refreshed is more costly because it has to force a refresh so it can fetch the document and update it. From that perspective I _think_ it is better to just index the document "on top" of the old document. No refresh ought to be required though that is worth testing just to make sure.

---

<div class="post-metadata">

**Author:** ![Alex\_Davidovich](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@Alex\_Davidovich](https://discuss.elastic.co/u/Alex_Davidovich)\
**Post date:** [April 26, 2017, 2:54pm UTC](https://discuss.elastic.co/t/create-vs-update/83673/3 "2017-04-26T14:54:05Z")

</div>

> [@nik9000](#):
>
> updating a document before it has been refreshed is more costly because it has to force a refresh so it can fetch the d

Thank you.  
So to sum up, update before a refresh is more costly than creation.  
Update, in general, is also more costly?

---

<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:** [April 26, 2017, 2:58pm UTC](https://discuss.elastic.co/t/create-vs-update/83673/4 "2017-04-26T14:58:57Z")

</div>

Updating is more costly when indexing, but potentially a lot cheaper when querying as you do not need to identify the latest version.

---

<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 24, 2017, 3:04pm UTC](https://discuss.elastic.co/t/create-vs-update/83673/5 "2017-05-24T15:04:34Z")

</div>

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