Elasticsearch-PHP 重建索引未按预期工作
Elasticsearch-PHP reindex not working as expected
/*
$params['refresh'] = (boolean) Should the effected indexes be refreshed?
['timeout'] = (time) Time each individual bulk request should wait for shards that are unavailable
['consistency'] = (enum) Explicit write consistency setting for the operation
['wait_for_completion'] = (boolean) Should the request should block until the reindex is complete
['requests_per_second'] = (float) The throttle for this request in sub-requests per second. 0 means set no throttle
['body'] = (array) The search definition using the Query DSL and the prototype for the index request (Required)
['body'] = (array) Request body
*/
$params = [
// ...
];
$client = ClientBuilder::create()->build();
$response = $client->reindex($params);
Elasticsearch 版本为 5.6.13。
我试图使用上面的 PHP 客户端重新索引 API 将源索引重新索引到目标索引。 sourceIndex 只有 1 个文档。
要求:
$params = [
'body' => [
'source' => [
'index' => 'sourceIndex',
],
'dest' => [
'index' => 'destIndex'
]
]
];
$response = $client->reindex($params);
回复:
(
[took] => 2
[timed_out] =>
[total] => 0
[updated] => 0
[created] => 0
[deleted] => 0
[batches] => 0
[version_conflicts] => 0
[noops] => 0
[retries] => Array
(
[bulk] => 0
[search] => 0
)
[throttled_millis] => 0
[requests_per_second] => -1
[throttled_until_millis] => 0
[failures] => Array
(
)
)
如您所见,重新索引的文档为 0([总计] => 0)。
使用 Kibana 的 DevTool 时它工作正常,但不是 elasticsearch-php 客户端。
POST _reindex
{
"source": {
"index": "sourceIndex"
},
"dest": {
"index": "destIndex"
}
}
感谢任何帮助。如果您需要更多详细信息来帮助回答这个问题,请告诉我。
仅供参考 - 以防有人遇到同样的问题。问题是源索引已将 refresh_interval 设置为 -1。要使重新索引操作生效,只需在调用 _reindex API.
之前刷新源索引
/*
$params['refresh'] = (boolean) Should the effected indexes be refreshed?
['timeout'] = (time) Time each individual bulk request should wait for shards that are unavailable
['consistency'] = (enum) Explicit write consistency setting for the operation
['wait_for_completion'] = (boolean) Should the request should block until the reindex is complete
['requests_per_second'] = (float) The throttle for this request in sub-requests per second. 0 means set no throttle
['body'] = (array) The search definition using the Query DSL and the prototype for the index request (Required)
['body'] = (array) Request body
*/
$params = [
// ...
];
$client = ClientBuilder::create()->build();
$response = $client->reindex($params);
Elasticsearch 版本为 5.6.13。
我试图使用上面的 PHP 客户端重新索引 API 将源索引重新索引到目标索引。 sourceIndex 只有 1 个文档。
要求:
$params = [
'body' => [
'source' => [
'index' => 'sourceIndex',
],
'dest' => [
'index' => 'destIndex'
]
]
];
$response = $client->reindex($params);
回复:
(
[took] => 2
[timed_out] =>
[total] => 0
[updated] => 0
[created] => 0
[deleted] => 0
[batches] => 0
[version_conflicts] => 0
[noops] => 0
[retries] => Array
(
[bulk] => 0
[search] => 0
)
[throttled_millis] => 0
[requests_per_second] => -1
[throttled_until_millis] => 0
[failures] => Array
(
)
)
如您所见,重新索引的文档为 0([总计] => 0)。
使用 Kibana 的 DevTool 时它工作正常,但不是 elasticsearch-php 客户端。
POST _reindex
{
"source": {
"index": "sourceIndex"
},
"dest": {
"index": "destIndex"
}
}
感谢任何帮助。如果您需要更多详细信息来帮助回答这个问题,请告诉我。
仅供参考 - 以防有人遇到同样的问题。问题是源索引已将 refresh_interval 设置为 -1。要使重新索引操作生效,只需在调用 _reindex API.
之前刷新源索引