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