Since I moved from 2.4 to 5.6, I have an error when using a scroll query :
$query = '{
"scroll" : "1m",
"scroll_id" : "'. $scrollId .'"
}';
$path = '/_search/scroll';
$responseArray = $this->sendQuery($index, $path, Request::GET, $query);
error :
CRITICAL - Uncaught PHP Exception Elastica\\Exception\\ResponseException: "no such index [index: ]" at /code/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php line 179
Here the initial query I'm using :
$path = 'dataIndex/_search?scroll=1m';
$query = sprintf(
'{
"size" : 500,
"stored_fields": "_source"
}'
);
And how I call my scroll function
$hits = $this->getElasticNextScroll($this->dataIndex, $hits['_scroll_id']);
One of the solution I tried was to send the request with POST but I got another error :
CRITICAL - Uncaught PHP Exception Elastica\\Exception\\ResponseException: "String index out of range: 0" at /code/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php line 179
EDIT SOLUTION :
the path '/_search/scroll' worked in 2.4 but doesn't work anymore in 5.3. You need to remove the first / : '_search/scroll'
指定将什么值传递给$ index以及什么包含在Request :: GET函数中
Index {#9208
-originalName: null
-typeCache: []
#_name: "index_data"
#_client: Client {#9234
-indexCache: array:1 [
"index_data" => Index {#9208}
]
-stopwatch: Stopwatch {#157
...
And here the stack error I have :
[1] Elastica\\Exception\\ResponseException: no such index [index: ] at n/a in /code/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php line 179
at Elastica\\Transport\\Http->exec(object(Request), array('connection' => array('config' => array('headers' => array(), 'curl' => array()), 'host' => '127.0.0.1', 'port' => '9200', 'logger' => false, 'ssl' => false, 'compression' => false, 'retryOnConflict' => '0', 'enabled' => true))) in /code/vendor/ruflin/elastica/lib/Elastica/Request.php line 193
at Elastica\\Request->send() in /code/vendor/ruflin/elastica/lib/Elastica/Client.php line 674
at Elastica\\Client->request('/_search/scroll', 'GET', '{ "scroll" : "1m", "scroll_id" : "DnF1ZXJ5VGhlbkZldGNoBAAAAAAAAAPfFnF2VnFBRzFWU0RTaTAwVVZLSl9UU2cAAAAAAAAD3RZxdlZxQUcxVlNEU2kwMFVWS0pfVFNnAAAAAAAAA-AWcXZWcUFHMVZTRFNpMDBVVktKX1RTZwAAAAAAAAPeFnF2VnFBRzFWU0RTaTAwVVZLSl9UU2c=" }', array(), 'application/json') in /code/vendor/friendsofsymfony/elastica-bundle/Elastica/Client.php line 50
at FOS\\ElasticaBundle\\Elastica\\Client->request('/_search/scroll', 'GET', '{ "scroll" : "1m", "scroll_id" : "DnF1ZXJ5VGhlbkZldGNoBAAAAAAAAAPfFnF2VnFBRzFWU0RTaTAwVVZLSl9UU2cAAAAAAAAD3RZxdlZxQUcxVlNEU2kwMFVWS0pfVFNnAAAAAAAAA-AWcXZWcUFHMVZTRFNpMDBVVktKX1RTZwAAAAAAAAPeFnF2VnFBRzFWU0RTaTAwVVZLSl9UU2c=" }') in /code/src/AppBundle/Repository/ElasticSearch/BaseElasticSearchRepository.php line 22
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.