# Scan and Scroll : URI length exceeds the configured limit

**URL:** <https://discuss.elastic.co/t/scan-and-scroll-uri-length-exceeds-the-configured-limit/37851>\
**Category:** Elasticsearch\
**Created:** [December 23, 2015, 11:46am UTC](https://discuss.elastic.co/t/scan-and-scroll-uri-length-exceeds-the-configured-limit/37851 "2015-12-23T11:46:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shabbir\_Challawala](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Shabbir\_Challawala](https://discuss.elastic.co/u/Shabbir_Challawala)\
**Post date:** [December 23, 2015, 11:46am UTC](https://discuss.elastic.co/t/scan-and-scroll-uri-length-exceeds-the-configured-limit/37851/1 "2015-12-23T11:46:17Z")

</div>

I am working in ElasticSearch 2.1, Php library is elastic/elasticsearch-php and Elasticsearch is hosted on .aws.found.io

to work on large dataset of search result, we are using scan and scroll functionality. In scroll we are getting error like URI length exceeds the configured limit of 8192 characters.

My code looks like below.  
$params = [  
"search\_type" =\> "scan", // use search\_type=scan  
"scroll" =\> "30s", // how long between scroll requests. should be small!  
"size" =\> 50, // how many results per shard you want back  
"index" =\> "my\_index",  
"body" =\> [multiple\_params\_here]  
]  
];

$docs = $client-\>search($params); // Execute the search  
$scroll\_id = $docs['\_scroll\_id']; // The response will contain no results, just a \_scroll\_id

while (\true) {

$response = $client-\>scroll([  
"scroll\_id" =\> $scroll\_id, //...using our previously obtained \_scroll\_id  
"scroll" =\> "30s" // and the same timeout window  
]  
);

if (count($response['hits']['hits']) \> 0) {  
foreach ($response['hits']['hits'] as $hit) {  
//doing some activity here  
}  
$scroll\_id = $response['\_scroll\_id'];  
} else {  
break;  
}  
}

Any help would be great

---

<div class="post-metadata">

**Author:** ![vrkansagara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vrkansagara/32/6804_2.png) [@vrkansagara](https://discuss.elastic.co/u/vrkansagara)\
**Post date:** [December 23, 2015, 11:51am UTC](https://discuss.elastic.co/t/scan-and-scroll-uri-length-exceeds-the-configured-limit/37851/2 "2015-12-23T11:51:21Z")

</div>

I am also having the same issue hope community will resolve this one on the ASAP bases.

---

<div class="post-metadata">

**Author:** ![voipoclay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/voipoclay/32/4372_2.png) [@voipoclay](https://discuss.elastic.co/u/voipoclay)\
**Post date:** [December 23, 2015, 2:34pm UTC](https://discuss.elastic.co/t/scan-and-scroll-uri-length-exceeds-the-configured-limit/37851/3 "2015-12-23T14:34:10Z")

</div>

Check out my post here

> [@Scan and Scroll 100 Index Limit](https://discuss.elastic.co/t/scan-and-scroll-100-index-limit/29819/4):
>
> found the answer to my own question. Following the api at the following link [https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/\_search\_operations.html#\_scan\_scroll](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/_search_operations.html#_scan_scroll) ... I found that using scroll\_id in the URI became too long in the while loop so it didn't work once indices reached a certain size. Specifying it the way the docs say to makes it a GET request and therefore eventually truncates the request URI. I just removed it and made the body attribute the scroll\_id and then …

Hope this helps

---

<div class="post-metadata">

**Author:** ![Shabbir\_Challawala](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Shabbir\_Challawala](https://discuss.elastic.co/u/Shabbir_Challawala)\
**Post date:** [December 23, 2015, 3:27pm UTC](https://discuss.elastic.co/t/scan-and-scroll-uri-length-exceeds-the-configured-limit/37851/4 "2015-12-23T15:27:53Z")

</div>

Thank you buddy, It seems working. Saved lots of time for me.

---

<div class="post-metadata">

**Author:** ![vrkansagara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vrkansagara/32/6804_2.png) [@vrkansagara](https://discuss.elastic.co/u/vrkansagara)\
**Post date:** [January 11, 2016, 9:18am UTC](https://discuss.elastic.co/t/scan-and-scroll-uri-length-exceeds-the-configured-limit/37851/5 "2016-01-11T09:18:36Z")

</div>

It's great to hear from you @voipoclay in short time.

This will solve my problem and saved a lot more time on DRY coding style.

Thanks a lot.

---

<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, 11:25pm UTC](https://discuss.elastic.co/t/scan-and-scroll-uri-length-exceeds-the-configured-limit/37851/6 "2017-07-05T23:25:28Z")

</div>


