# Java Out Of Memory error while indexing data into elasticsearch

**URL:** <https://discuss.elastic.co/t/java-out-of-memory-error-while-indexing-data-into-elasticsearch/25062>\
**Category:** Elasticsearch\
**Created:** [July 7, 2015, 3:59pm UTC](https://discuss.elastic.co/t/java-out-of-memory-error-while-indexing-data-into-elasticsearch/25062 "2015-07-07T15:59:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shishir\_Shikarkhane](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@Shishir\_Shikarkhane](https://discuss.elastic.co/u/Shishir_Shikarkhane)\
**Post date:** [July 7, 2015, 3:59pm UTC](https://discuss.elastic.co/t/java-out-of-memory-error-while-indexing-data-into-elasticsearch/25062/1 "2015-07-07T15:59:00Z")

</div>

Hello ,  
We are facing Java OOM issue while indexing data into elasticsearch .

We are reading close to 33 million records with 36 columns from Oracle database .We have broken data into 32 threads with every thread loading close to 1 million records .  
We are using Bulk API and the bulk size is set to 10000 records .  
Here are the details :

JVM heap size : 8 GB .  
Java Version:1.6.0\_45  
JVM: Java HotSpot(TM) 64-Bit Server VM

Appreciate any pointers .

Thanks  
Shishir

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 7, 2015, 4:12pm UTC](https://discuss.elastic.co/t/java-out-of-memory-error-while-indexing-data-into-elasticsearch/25062/2 "2015-07-07T16:12:46Z")

</div>

You could either reduce the number of threads or the bulk size?  
Also, it sounds like you are using a very old version of elasticsearch as JAVA 1.6 is not supported anymore.

Could you consider upgrading?

---

<div class="post-metadata">

**Author:** ![Shishir\_Shikarkhane](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@Shishir\_Shikarkhane](https://discuss.elastic.co/u/Shishir_Shikarkhane)\
**Post date:** [July 7, 2015, 4:30pm UTC](https://discuss.elastic.co/t/java-out-of-memory-error-while-indexing-data-into-elasticsearch/25062/3 "2015-07-07T16:30:24Z")

</div>

We are using elastic version 1.1.1  
Can you pls suggest which is most stable version I should upgrade to ?

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [July 7, 2015, 5:01pm UTC](https://discuss.elastic.co/t/java-out-of-memory-error-while-indexing-data-into-elasticsearch/25062/4 "2015-07-07T17:01:35Z")

</div>

> [@Shishir\_Shikarkhane](#):
>
> Can you pls suggest which is most stable version I should upgrade to ?

> **[Support Matrix](https://www.elastic.co/support/matrix)**

---

<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:03am UTC](https://discuss.elastic.co/t/java-out-of-memory-error-while-indexing-data-into-elasticsearch/25062/5 "2017-07-06T00:03:06Z")

</div>


