Question about Update API

Sorry , im newbie in elasticsearch and i have a question.

I read in

https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html
and
https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-update.html

I saw there more way update index. UpdateRequest ,prepareUpdate() method, Update by script

My question is : What different about it and what faster ?

Thanks for your help :smile:

Not really the answer but are you sure you really need the update API?

Just do another PUT request /index/type/id
With the full new version of your document and update will be done.

1 Like

Thanks :slight_smile:

Im just curious about it .
if put request can do like update . Why UpdateRequest ,prepareUpdate() method, Update by script was born :slight_smile:

We can use update elasticsearch in where? when ? and how?

Can you explain it to me ? Im just curious

It's useful when you have very big documents. Let say thousands of fields.

Instead of sending on the network mb of data you can in that case just send a smaller amount of data.

Behind the scene, elasticsearch will get the original doc, update it in memory using what you send as update (script or part of the doc), then will PUT this new version of the doc.

thank you very much.

What fastest in it ? What different about "update request" and "prepareUpdate" or "update by script" ?

i curious about it because have more different with Statement and PreparedStatement in java. Thus i think have anything i dont know.

Can you explain it to me please ?