# Recover from Out of Memory Error

**URL:** <https://discuss.elastic.co/t/recover-from-out-of-memory-error/59111>\
**Category:** Elasticsearch\
**Created:** [August 28, 2016, 8:20am UTC](https://discuss.elastic.co/t/recover-from-out-of-memory-error/59111 "2016-08-28T08:20:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![muhamadli302](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@muhamadli302](https://discuss.elastic.co/u/muhamadli302)\
**Post date:** [August 28, 2016, 8:20am UTC](https://discuss.elastic.co/t/recover-from-out-of-memory-error/59111/1 "2016-08-28T08:20:19Z")

</div>

Hi,

I have ES 1.7, and I got an "Out of Memory Error, Java Heap Space"  
I know the cause is that I don't have enough RAM for the amount of data I'm inserting ES. Unfortunately, new hardware is coming only in a few weeks.

My questions are:

1. How to recover the index (it's status is yellow) so that I could keep using it?
2. How to insert small amounts of data so it won't happen again? (I'm using logstash 2.1 and filebeat, and have limited the bulk\_max\_size to 20)

Thanks

---

<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:** [August 28, 2016, 8:24am UTC](https://discuss.elastic.co/t/recover-from-out-of-memory-error/59111/2 "2016-08-28T08:24:16Z")

</div>

> [@muhamadli302](#):
>
> 1. How to recover the index (it's status is yellow) so that I could keep using it?

Yellow is ok-ish, it means it cannot assign a replica. You can remove the replica and then readd it via the APIs.

> [@muhamadli302](#):
>
> 1. How to insert small amounts of data so it won't happen again? (I'm using logstash 2.1 and filebeat, and have limited the bulk\_max\_size to 20)

How do you know this was the issue?

---

<div class="post-metadata">

**Author:** ![muhamadli302](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@muhamadli302](https://discuss.elastic.co/u/muhamadli302)\
**Post date:** [August 28, 2016, 8:59am UTC](https://discuss.elastic.co/t/recover-from-out-of-memory-error/59111/3 "2016-08-28T08:59:19Z")

</div>

Hi, thanks for the answer

1. But I still have a problem... When looking at the index on kibana it gives me the OOM error and I can't query the index.

2. I assume it's the problem since it happens when I'm inserting large amounts of data. For example I first had bulk\_max\_size defined to 50 (it's the default) and I got OOM after an hour or so... When changing to bulk\_max\_size to 20 it worked for almost a week, inserting 130 million documents.

---

<div class="post-metadata">

**Author:** ![muhamadli302](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@muhamadli302](https://discuss.elastic.co/u/muhamadli302)\
**Post date:** [August 30, 2016, 6:11am UTC](https://discuss.elastic.co/t/recover-from-out-of-memory-error/59111/4 "2016-08-30T06:11:01Z")

</div>

Any help?

---

<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:** [August 30, 2016, 8:54am UTC](https://discuss.elastic.co/t/recover-from-out-of-memory-error/59111/5 "2016-08-30T08:54:57Z")

</div>

Please post the full error you receive.

---

<div class="post-metadata">

**Author:** ![muhamadli302](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@muhamadli302](https://discuss.elastic.co/u/muhamadli302)\
**Post date:** [August 30, 2016, 9:58am UTC](https://discuss.elastic.co/t/recover-from-out-of-memory-error/59111/6 "2016-08-30T09:58:08Z")

</div>

On kibana I see:  
"ElasticsearchException[java.lang.OutOfMemoryError: Java heap space]"

I can't get you the ES logs right now since it on a closed network.

---

<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:24pm UTC](https://discuss.elastic.co/t/recover-from-out-of-memory-error/59111/7 "2017-07-05T22:24:08Z")

</div>


