【问题标题】:no such index [index: ] when trying to scroll with elasticsearch尝试使用弹性搜索滚动时没有这样的索引 [索引:]
【发布时间】: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


【解决方案1】:

指定传递给 $index 的值以及 Request :: GET 函数中包含的值

【讨论】:

    【解决方案2】:
    Index {#9208 
    -originalName: null
    -typeCache: []
    #_name: "index_data"
    #_client: Client {#9234
    -indexCache: array:1 [
      "index_data" => Index {#9208}
    ]
    -stopwatch: Stopwatch {#157
    ...
    

    这里是我遇到的堆栈错误:

    [1] Elastica\Exception\ResponseException: no such index [index: ] at n/a in /code/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php line 179

    在 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))) 在 /code/vendor/ruflin/elastica/lib/Elastica/Request.php 第 193 行

    在 /code/vendor/ruflin/elastica/lib/Elastica/Client.php 第 674 行中的 Elastica\Request->send() 处

    在弹性曲线\客户 - >请求( '/ _搜索/滚动', 'GET', '{ “滚动”: “1M”, “scroll_id”: “DnF1ZXJ5VGhlbkZldGNoBAAAAAAAAAPfFnF2VnFBRzFWU0RTaTAwVVZLSl9UU2cAAAAAAAAD3RZxdlZxQUcxVlNEU2kwMFVWS0pfVFNnAAAAAAAAA-AWcXZWcUFHMVZTRFNpMDBVVktKX1RTZwAAAAAAAAPeFnF2VnFBRzFWU0RTaTAwVVZLSl9UU2c =”}',阵列(),' application/json') 在 /code/vendor/friendsofsymfony/elastica-bundle/Elastica/Client.php 第 50 行

    在FOS \ ElasticaBundle \弹性曲线\客户 - >请求( '/ _搜索/滚动', 'GET', '{ “滚动”: “1M”, “scroll_id”: “DnF1ZXJ5VGhlbkZldGNoBAAAAAAAAAPfFnF2VnFBRzFWU0RTaTAwVVZLSl9UU2cAAAAAAAAD3RZxdlZxQUcxVlNEU2kwMFVWS0pfVFNnAAAAAAAAA-AWcXZWcUFHMVZTRFNpMDBVVktKX1RTZwAAAAAAAAPeFnF2VnFBRzFWU0RTaTAwVVZLSl9UU2c =”}')在/code/src/AppBundle/Repository/ElasticSearch/BaseElasticSearchRepository.php 第22行

    【讨论】:

      猜你喜欢
      • 2018-08-20
      • 2016-10-24
      • 1970-01-01
      • 2012-05-07
      • 1970-01-01
      相关资源
      最近更新 更多