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

**URL:** <https://discuss.elastic.co/t/whats-different-between-reindexing-an-exist-document-and-updating-some-field-of-document/254152>\
**Category:** Elasticsearch\
**Created:** [November 3, 2020, 12:23pm UTC](https://discuss.elastic.co/t/whats-different-between-reindexing-an-exist-document-and-updating-some-field-of-document/254152 "2020-11-03T12:23:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DumpCat](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@DumpCat](https://discuss.elastic.co/u/DumpCat)\
**Post date:** [November 3, 2020, 12:23pm UTC](https://discuss.elastic.co/t/whats-different-between-reindexing-an-exist-document-and-updating-some-field-of-document/254152/1 "2020-11-03T12:23:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [November 3, 2020, 12:34pm UTC](https://discuss.elastic.co/t/whats-different-between-reindexing-an-exist-document-and-updating-some-field-of-document/254152/2 "2020-11-03T12:34:52Z")

</div>

The [update API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html) 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](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html) 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.

---

<div class="post-metadata">

**Author:** ![DumpCat](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@DumpCat](https://discuss.elastic.co/u/DumpCat)\
**Post date:** [November 3, 2020, 12:48pm UTC](https://discuss.elastic.co/t/whats-different-between-reindexing-an-exist-document-and-updating-some-field-of-document/254152/3 "2020-11-03T12:48:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [November 3, 2020, 2:33pm UTC](https://discuss.elastic.co/t/whats-different-between-reindexing-an-exist-document-and-updating-some-field-of-document/254152/4 "2020-11-03T14:33:06Z")

</div>

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.

---

<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:** [December 1, 2020, 2:33pm UTC](https://discuss.elastic.co/t/whats-different-between-reindexing-an-exist-document-and-updating-some-field-of-document/254152/5 "2020-12-01T14:33:08Z")

</div>

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