【发布时间】:2017-10-16 15:43:50
【问题描述】:
自从我从 2.4 迁移到 5.6 后,使用滚动查询时出现错误:
$query = '{
"scroll" : "1m",
"scroll_id" : "'. $scrollId .'"
}';
$path = '/_search/scroll';
$responseArray = $this->sendQuery($index, $path, Request::GET, $query);
错误:
CRITICAL - 未捕获的 PHP 异常 Elastica\Exception\ResponseException: "no such index [index: ]" at /code/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php line 179
这里是我使用的初始查询:
$path = 'dataIndex/_search?scroll=1m';
$query = sprintf(
'{
"size" : 500,
"stored_fields": "_source"
}'
);
以及我如何调用我的滚动功能
$hits = $this->getElasticNextScroll($this->dataIndex, $hits['_scroll_id']);
我尝试的解决方案之一是使用 POST 发送请求,但我收到另一个错误:
严重 - 未捕获的 PHP 异常 Elastica\Exception\ResponseException:“字符串索引超出范围:0”在 /code/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php 第 179 行
编辑解决方案:
路径“/_search/scroll”在 2.4 中有效,但在 5.3 中不再有效。您需要删除第一个 / : '_search/scroll'
【问题讨论】:
-
这一行上方$index的值是多少:$responseArray = $this->sendQuery($index, $path, Request::GET, $query); ?
-
请参阅下面的评论,我在初始查询和滚动查询中都发送了相同的索引,但它仅适用于第一个查询
标签: php symfony elasticsearch