# Script vs Document for partial update

**URL:** https://discuss.elastic.co/t/script-vs-document-for-partial-update/64494
**Category:** Elasticsearch
**Created:** [October 31, 2016, 9:20pm UTC](https://discuss.elastic.co/t/script-vs-document-for-partial-update/64494 "2016-10-31T21:20:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vijai.natarajan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vijai.natarajan/32/12855_2.png) [@vijai.natarajan](https://discuss.elastic.co/u/vijai.natarajan)
#### Post date: [October 31, 2016, 9:20pm UTC](https://discuss.elastic.co/t/script-vs-document-for-partial-update/64494/1 "2016-10-31T21:20:03Z")

</div>

I saw there are two ways to do partial update. One is via doc parameter and one via scripts. [https://www.elastic.co/guide/en/elasticsearch/guide/master/partial-updates.html](https://www.elastic.co/guide/en/elasticsearch/guide/master/partial-updates.html)

I like to know which one is better. What are the advantages and disadvantages of each approach?

Specifically for doing something like [https://github.com/thinkaurelius/titan/blob/titan10/titan-es/src/main/java/com/thinkaurelius/titan/diskstorage/es/ElasticSearchIndex.java#L650](https://github.com/thinkaurelius/titan/blob/titan10/titan-es/src/main/java/com/thinkaurelius/titan/diskstorage/es/ElasticSearchIndex.java#L650) will document update work better than script update?

---

<div class="post-metadata">

### Author: ![kartheek91](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@kartheek91](https://discuss.elastic.co/u/kartheek91)
#### Post date: [November 1, 2016, 5:37am UTC](https://discuss.elastic.co/t/script-vs-document-for-partial-update/64494/2 "2016-11-01T05:37:31Z")

</div>

TO update the document Elasticsearch follows delete and index the document.

So there are two ways as you mentioned partial update using scripts as well as partial update using documents.

I would consider the first one i.e. using scripts which is we can update based on condition where as using document we may concentrate or stick on to that document.

---

<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: [July 5, 2017, 10:07pm UTC](https://discuss.elastic.co/t/script-vs-document-for-partial-update/64494/3 "2017-07-05T22:07:59Z")

</div>


