Index vs Update

Hello

I'd like to ask the same question again raised here: What's the benefit of the Update API (POST /_update) vs Index (PUT /_doc).

As far as I can see Update (with doc_as_upsert: true) is identical in effect to Index.

The original answer above suggested that Index did not support partial updates but it does: if you PUT /_doc with only one field in the request BODY it adds that one field to an existing document.

So are the 2 methods (Update with upsert and Index) identical?

A little experimentation has shown:

  • Index will always update the document's _version field even if nothing changed
  • Update will leave the document (and _version) unchanged if nothing changed

I'm using the update API only if I have a very very big document to update. That would save a bit of network usage and memory.

Otherwise, in 99,9% of the time, I'm only using the index API.

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