# READs in Insert VS update

**URL:** <https://discuss.elastic.co/t/reads-in-insert-vs-update/86997>\
**Category:** Elasticsearch\
**Created:** [May 24, 2017, 3:04pm UTC](https://discuss.elastic.co/t/reads-in-insert-vs-update/86997 "2017-05-24T15:04:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepak\_Mehta1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deepak_mehta1/32/94163_2.png) [@Deepak\_Mehta1](https://discuss.elastic.co/u/Deepak_Mehta1)\
**Post date:** [May 24, 2017, 3:04pm UTC](https://discuss.elastic.co/t/reads-in-insert-vs-update/86997/1 "2017-05-24T15:04:41Z")

</div>

We have requirement where we first need to add the document and then update the document.  
We are for now, using update api to do add and update.  
I see many reads in disk and if we disable the indexing then reads decrease to great extend.

Is update api is making the read?

If I change the update api to index api with ID, would it make any difference.  
I have this question as I see if you pass ID in index api, and try to index same document twice with same id, then Es would change the version of document, Which made me suspicious that, ES is doing read is index as well. Is that true?

Would changing from UPDATE to Index make any difference on READ?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 24, 2017, 3:39pm UTC](https://discuss.elastic.co/t/reads-in-insert-vs-update/86997/2 "2017-05-24T15:39:57Z")

</div>

Index a document is a write (index operation of the whole content).  
Index again a document is a delete + index operation of the whole content  
Update a document is a get + merge in memory the previous content with the new one + delete + index operation of the whole content

HTH

---

<div class="post-metadata">

**Author:** ![Deepak\_Mehta1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deepak_mehta1/32/94163_2.png) [@Deepak\_Mehta1](https://discuss.elastic.co/u/Deepak_Mehta1)\
**Post date:** [May 24, 2017, 4:21pm UTC](https://discuss.elastic.co/t/reads-in-insert-vs-update/86997/3 "2017-05-24T16:21:56Z")

</div>

> [@dadoonet](#):
>
> Index again a document is a delete + index operation of the whole content

So does Elasticsearch do GET request to find out document with same ID already exist?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 24, 2017, 4:42pm UTC](https://discuss.elastic.co/t/reads-in-insert-vs-update/86997/4 "2017-05-24T16:42:30Z")

</div>

When doing updates you mean? Yes.

---

<div class="post-metadata">

**Author:** ![Deepak\_Mehta1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deepak_mehta1/32/94163_2.png) [@Deepak\_Mehta1](https://discuss.elastic.co/u/Deepak_Mehta1)\
**Post date:** [May 24, 2017, 4:46pm UTC](https://discuss.elastic.co/t/reads-in-insert-vs-update/86997/5 "2017-05-24T16:46:45Z")

</div>

Not at time of update.

If I index one document with ID and then again execute index request with same ID? Does it do get request to find its version 2?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 24, 2017, 5:06pm UTC](https://discuss.elastic.co/t/reads-in-insert-vs-update/86997/6 "2017-05-24T17:06:11Z")

</div>

Not really. It will just delete the old doc and create a new one

---

<div class="post-metadata">

**Author:** ![Deepak\_Mehta1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deepak_mehta1/32/94163_2.png) [@Deepak\_Mehta1](https://discuss.elastic.co/u/Deepak_Mehta1)\
**Post date:** [May 24, 2017, 5:07pm UTC](https://discuss.elastic.co/t/reads-in-insert-vs-update/86997/7 "2017-05-24T17:07:28Z")

</div>

Ok Thanks

---

<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:** [June 21, 2017, 5:08pm UTC](https://discuss.elastic.co/t/reads-in-insert-vs-update/86997/8 "2017-06-21T17:08:10Z")

</div>

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