# Scroll search | Caused by: java.io.IOException: entity content is too long \[226508429\] for the configured buffer limit \[1029760\]

**URL:** <https://discuss.elastic.co/t/scroll-search-caused-by-java-io-ioexception-entity-content-is-too-long-226508429-for-the-configured-buffer-limit-1029760/207202>\
**Category:** Elasticsearch\
**Created:** [November 9, 2019, 5:39am UTC](https://discuss.elastic.co/t/scroll-search-caused-by-java-io-ioexception-entity-content-is-too-long-226508429-for-the-configured-buffer-limit-1029760/207202 "2019-11-09T05:39:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijaykriishna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vijaykriishna/32/42737_2.png) [@vijaykriishna](https://discuss.elastic.co/u/vijaykriishna)\
**Post date:** [November 9, 2019, 5:39am UTC](https://discuss.elastic.co/t/scroll-search-caused-by-java-io-ioexception-entity-content-is-too-long-226508429-for-the-configured-buffer-limit-1029760/207202/1 "2019-11-09T05:39:25Z")

</div>

Hi All,

I've implemented scroll search on an index with 348,004 documents in it.

Code:

```
  SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().fetchSource(includes, null)
      .size(20000);
  searchSourceBuilder.parseXContent(xContentParser);
  SearchRequest searchRequest = new SearchRequest(new String[] {index}, searchSourceBuilder).scroll(new TimeValue(60000));

```

I see exception as mentioned below.

`Caused by: java.io.IOException: entity content is too long [226508429] for the configured buffer limit [1029760]`

`Caused by: org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 498706319; received: 343343104`

Added the code:

```
RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder();
builder.setHttpAsyncResponseConsumerFactory(new HttpAsyncResponseConsumerFactory.HeapBufferedResponseConsumerFactory(
    NumberUtils.toInt(1029760000));

```

Then i checked the behaviour by setting `http.max_content_length: 2048mb` in elasticsearch.yml but it was of no use.

Please help me address the issue, how to deal with this. Did i miss something ?

BR  
Vijay

---

<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:** [December 8, 2019, 2:04pm UTC](https://discuss.elastic.co/t/scroll-search-caused-by-java-io-ioexception-entity-content-is-too-long-226508429-for-the-configured-buffer-limit-1029760/207202/3 "2019-12-08T14:04:46Z")

</div>

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