我正在尝试使用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
有什么想法吗?
问题是您将滚动参数放在 json 正文中,但它应该在 URL 中。
例如index-name/_search?scroll=30s
不要忘记将其从$params
中删除
您可能不小心将滚动属性放在正文中。