# Using the Bulk Indexing API, if my node crashes, my elasticsearch heap memory does not get freed

**URL:** https://discuss.elastic.co/t/using-the-bulk-indexing-api-if-my-node-crashes-my-elasticsearch-heap-memory-does-not-get-freed/25839
**Category:** Elasticsearch
**Created:** [July 18, 2015, 3:54am UTC](https://discuss.elastic.co/t/using-the-bulk-indexing-api-if-my-node-crashes-my-elasticsearch-heap-memory-does-not-get-freed/25839 "2015-07-18T03:54:33Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![sahilc2200](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sahilc2200/32/3669_2.png) [@sahilc2200](https://discuss.elastic.co/u/sahilc2200)
#### Post date: [July 18, 2015, 3:54am UTC](https://discuss.elastic.co/t/using-the-bulk-indexing-api-if-my-node-crashes-my-elasticsearch-heap-memory-does-not-get-freed/25839/1 "2015-07-18T03:54:33Z")

</div>

So I am using the Bulk indexing API for ES 1.6. If a OOM occurs, then on restart, the node's heap does not get cleared for some reason. Then, OOM's occur much faster. I am not using any other queries except to index my documents, and I am running a two node cluster with 9GB allocated to each machine, and I have to index about 21M documents.

---

<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: [July 18, 2015, 4:00am UTC](https://discuss.elastic.co/t/using-the-bulk-indexing-api-if-my-node-crashes-my-elasticsearch-heap-memory-does-not-get-freed/25839/2 "2015-07-18T04:00:10Z")

</div>

If it's still OOMing then you likely have too much data in there, but more information will help. However how much data is in the cluster?

---

<div class="post-metadata">

### Author: ![sahilc2200](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sahilc2200/32/3669_2.png) [@sahilc2200](https://discuss.elastic.co/u/sahilc2200)
#### Post date: [July 18, 2015, 5:28am UTC](https://discuss.elastic.co/t/using-the-bulk-indexing-api-if-my-node-crashes-my-elasticsearch-heap-memory-does-not-get-freed/25839/3 "2015-07-18T05:28:10Z")

</div>

The cluster actually has like 50 GB worth of data, and I am indexing about 150 documents at a time. Each document is about 4KB on average.

---

<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: [July 18, 2015, 6:31am UTC](https://discuss.elastic.co/t/using-the-bulk-indexing-api-if-my-node-crashes-my-elasticsearch-heap-memory-does-not-get-freed/25839/4 "2015-07-18T06:31:04Z")

</div>

Then that's very odd.

If you start ES and then check `_cat/fielddata`, what does it report? Also, what's in your logs?

---

<div class="post-metadata">

### Author: ![sahilc2200](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sahilc2200/32/3669_2.png) [@sahilc2200](https://discuss.elastic.co/u/sahilc2200)
#### Post date: [July 18, 2015, 6:59am UTC](https://discuss.elastic.co/t/using-the-bulk-indexing-api-if-my-node-crashes-my-elasticsearch-heap-memory-does-not-get-freed/25839/5 "2015-07-18T06:59:22Z")

</div>

It tells me that there are 0b allocated for the fielddata. Is that supposed to happen? I am using ElasticHQ for monitoring the cluster, and it shows me that about 80% of the heap is occupied on node restart as well.

---

<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: [July 18, 2015, 7:00am UTC](https://discuss.elastic.co/t/using-the-bulk-indexing-api-if-my-node-crashes-my-elasticsearch-heap-memory-does-not-get-freed/25839/6 "2015-07-18T07:00:29Z")

</div>

Are you using parent/child or nesting?

---

<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 6, 2017, 12:00am UTC](https://discuss.elastic.co/t/using-the-bulk-indexing-api-if-my-node-crashes-my-elasticsearch-heap-memory-does-not-get-freed/25839/7 "2017-07-06T00:00:39Z")

</div>


