# ElasticSearch Cluster JVM Heap Increasing level while doing Queries and Writting

**URL:** <https://discuss.elastic.co/t/elasticsearch-cluster-jvm-heap-increasing-level-while-doing-queries-and-writting/183772>\
**Category:** Elasticsearch\
**Created:** [May 31, 2019, 5:16pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-jvm-heap-increasing-level-while-doing-queries-and-writting/183772 "2019-05-31T17:16:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![matheusribeirogarcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matheusribeirogarcia/32/44363_2.png) [@matheusribeirogarcia](https://discuss.elastic.co/u/matheusribeirogarcia)\
**Post date:** [May 31, 2019, 5:16pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-jvm-heap-increasing-level-while-doing-queries-and-writting/183772/1 "2019-05-31T17:16:58Z")

</div>

Hello,  
I have three Indexes, one have 11 million documents, I need to do 35.000 searches in that index. Is there a way to that and not increase my JVM Heap to the point where elastic fails? I'm using the Scroll API, and making queries that have size of 5000.

I also get this error:

> org.elasticsearch.client.ResponseException: method [POST], host , URI [/ensinosuperior/\_search?typed\_keys=true&ignore\_unavailable=false&expand\_wildcards=open&allow\_no\_indices=true&search\_type=query\_then\_fetch&batched\_reduce\_size=512], status line [HTTP/1.1 429 Too Many Requests]  
> {"error":{"root\_cause":[{"type":"circuit\_breaking\_exception","reason":"[parent] Data too large, data for [\<http\_request\>] would be [8127961922/7.5gb], which is larger than the limit of [8127315968/7.5gb], real usage: [8127961440/7.5gb], new bytes reserved: [482/482b]","bytes\_wanted":8127961922,"bytes\_limit":8127315968,"durability":"PERMANENT"}],"type":"circuit\_breaking\_exception","reason":"[parent] Data too large, data for [\<http\_request\>] would be [8127961922/7.5gb], which is larger than the limit of [8127315968/7.5gb], real usage: [8127961440/7.5gb], new bytes reserved: [482/482b]","bytes\_wanted":8127961922,"bytes\_limit":8127315968,"durability":"PERMANENT"},"status":429}

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 3, 2019, 12:35pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-jvm-heap-increasing-level-while-doing-queries-and-writting/183772/2 "2019-06-03T12:35:56Z")

</div>

can you explain why you need to use the scroll API for 35k requests? Also, are those concurrent? If so, the scroll API is not the way to go and you may want to look at the [search\_after](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-search-after.html) feature.

--Alex

---

<div class="post-metadata">

**Author:** ![matheusribeirogarcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matheusribeirogarcia/32/44363_2.png) [@matheusribeirogarcia](https://discuss.elastic.co/u/matheusribeirogarcia)\
**Post date:** [June 3, 2019, 6:03pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-jvm-heap-increasing-level-while-doing-queries-and-writting/183772/3 "2019-06-03T18:03:48Z")

</div>

Basically, each request queries one field in these 11 million documents, and totalizes its values, so I need the scroll API to scroll in these 11 million docs.

I'll check this `search_after` feature, thanks.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 3, 2019, 6:30pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-jvm-heap-increasing-level-while-doing-queries-and-writting/183772/4 "2019-06-03T18:30:24Z")

</div>

Can’t you use an aggregation for that?

---

<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 1, 2019, 6:30pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-jvm-heap-increasing-level-while-doing-queries-and-writting/183772/5 "2019-07-01T18:30:29Z")

</div>

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