Scan and Scroll : URI length exceeds the configured limit

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

1 Like

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

Check out my post here

Hope this helps

1 Like

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

2 Likes

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.