# Java API Massive Update Bulk

**URL:** <https://discuss.elastic.co/t/java-api-massive-update-bulk/62724>\
**Category:** Elasticsearch\
**Created:** [October 11, 2016, 2:43pm UTC](https://discuss.elastic.co/t/java-api-massive-update-bulk/62724 "2016-10-11T14:43:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kleber\_Rocha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kleber_rocha/32/12412_2.png) [@Kleber\_Rocha](https://discuss.elastic.co/u/Kleber_Rocha)\
**Post date:** [October 11, 2016, 2:43pm UTC](https://discuss.elastic.co/t/java-api-massive-update-bulk/62724/1 "2016-10-11T14:43:48Z")

</div>

Hi everyone,

I created a code to massive update script for documents apparently all working fine, but the update causes a very large use of ElasticSearch heap, to exhaust all the heap. And ElasticSearch does not recover, I have to restart the instances.

This behavior is expected, or am I doing something wrong?

Thank you

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 11, 2016, 11:51pm UTC](https://discuss.elastic.co/t/java-api-massive-update-bulk/62724/2 "2016-10-11T23:51:16Z")

</div>

You should reduce the bulk size if that is the case.

---

<div class="post-metadata">

**Author:** ![Kleber\_Rocha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kleber_rocha/32/12412_2.png) [@Kleber\_Rocha](https://discuss.elastic.co/u/Kleber_Rocha)\
**Post date:** [October 13, 2016, 12:01am UTC](https://discuss.elastic.co/t/java-api-massive-update-bulk/62724/3 "2016-10-13T00:01:57Z")

</div>

But what is the difference between bulk insert or update, why bulk insert does not cause this problem.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 13, 2016, 1:04am UTC](https://discuss.elastic.co/t/java-api-massive-update-bulk/62724/4 "2016-10-13T01:04:26Z")

</div>

An update retrieves the original document, then applies the update in memory, then reindexes the result.

---

<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:12pm UTC](https://discuss.elastic.co/t/java-api-massive-update-bulk/62724/5 "2017-07-05T22:12:50Z")

</div>


