What's different between reindexing an exist document and updating some field of document?

If I have an exist document,is reindexing whole new document better than updating some field of document?

The update API could probably be more usefully called the "patch" api - it allows you to send a partial document or script to a server and modify the existing content with this new information. e.g. you might want to simply add 1 to a "liked" count without changing the rest of the content.

The index API provides a complete new version of a document with the given ID, replacing entirely what is already there.

In the underlying Lucene index they both essentially delete the entirety of any old document and replace it with a brand new one. The update API just improves on the index API for those clients that want to avoid first dragging the old version to a client before making a modification.

Thanks your response! for update and reindex operation, I want to know what the performance different is. Is "update" operation more heavy(cost more time) than "index"? My colleague said update operation need to do "merge", so update operation will cost more time. Is it true?

It depends.
If your client GETs a document from elasticsearch, patches it in the client then sends the modified doc back in an index request then that may be more costly than just sending over the required changes using the update API and doing a local data read+patch in situ.

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