READs in Insert VS update


(Deepak Mehta) #1

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?


(David Pilato) #2

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


(Deepak Mehta) #3

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


(David Pilato) #4

When doing updates you mean? Yes.


(Deepak Mehta) #5

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?


(David Pilato) #6

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


(Deepak Mehta) #7

Ok Thanks


(system) #8

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