# Bulkindex in elasticsearch(facing exception heap size out of memory)

**URL:** https://discuss.elastic.co/t/bulkindex-in-elasticsearch-facing-exception-heap-size-out-of-memory/149270
**Category:** Elasticsearch
**Created:** [September 20, 2018, 10:27am UTC](https://discuss.elastic.co/t/bulkindex-in-elasticsearch-facing-exception-heap-size-out-of-memory/149270 "2018-09-20T10:27:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![johnrabi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johnrabi/32/67223_2.png) [@johnrabi](https://discuss.elastic.co/u/johnrabi)
#### Post date: [September 20, 2018, 10:27am UTC](https://discuss.elastic.co/t/bulkindex-in-elasticsearch-facing-exception-heap-size-out-of-memory/149270/1 "2018-09-20T10:27:15Z")

</div>

hi ,  
can anyone help me how to resolve this issue ?  
My Es version: 5.6.2  
I am using JestClient for connecting es  
language: java

I am having the list of datas (like 10000 ) how to write bulk index API facing exception while using for loop more than 2000 data? i have indexed like this

for(Data data : datas) {  
bulkRequest.addAction(new Index.Builder(MoveToElasticSearch(data)) .index("test\_prod").type("test").id(constructElasticId(data)).build());

}  
thanks in advance

---

<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: [October 18, 2018, 10:27am UTC](https://discuss.elastic.co/t/bulkindex-in-elasticsearch-facing-exception-heap-size-out-of-memory/149270/2 "2018-10-18T10:27:15Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
