[scroll]中VALUE_STRING的Elasticsearch Unknown键

时间:2018-03-21 05:09:30

标签: php elasticsearch php-7.2 elasticsearch-6

我正在尝试使用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);

但是[滚动]中的VALUE_STRING会收到类似于此未知键的错误。

目前使用Elasticsearch版本6.2.2

有什么想法吗?

2 个答案:

答案 0 :(得分:0)

您可能不小心将滚动属性放入正文中。

答案 1 :(得分:0)

问题是您将滚动参数放在json主体中,但应该改为在URL中。例如

index-name/_search?scroll=30s

别忘了也将其从$params中删除