【问题标题】:Elasticsearch Unknown key for a VALUE_STRING in [scroll][scroll] 中 VALUE_STRING 的 Elasticsearch 未知键
【发布时间】:2019-06-10 23:10:00
【问题描述】:

我正在尝试使用 PHP API,以及代码中给出的相同示例

https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/_search_operations.html#_scrolling

$client = ClientBuilder::create()->build();
$params = [
    "scroll" => "30s",          // how long between scroll requests. should be small!
    "size" => 50,               // how many results *per shard* you want back
    "index" => "my_index",
    "body" => [
        "query" => [
            "match_all" => new \stdClass()
        ]
    ]
];

// Execute the search
// The response will contain the first batch of documents
// and a scroll_id
$response = $client->search($params);

但是 [scroll] 中的 VALUE_STRING 出现类似 Unknown key 的错误。

目前使用 Elasticsearch 6.2.2 版

有什么想法吗?

【问题讨论】:

    标签: php elasticsearch php-7.2 elasticsearch-6


    【解决方案1】:

    问题是您将滚动参数放在 json 正文中,但它应该放在 URL 中。例如

    index-name/_search?scroll=30s
    

    不要忘记将其从 $params 中删除

    【讨论】:

      【解决方案2】:

      你可能不小心把滚动属性放在了body里面。

      【讨论】:

      • 请添加一些代码(避免滚动属性),以便其他用户可以测试您所描述的内容。谢谢!
      猜你喜欢
      • 1970-01-01
      • 2019-11-19
      • 2020-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多