以 2.4.x 为例 说明 reindex 的基本用法
The reindex API is new and should still be considered experimental. The API may change in ways that are not backwards compatible
reindex API是新的,应该仍然被认为是实验性的。 API可能以不向后兼容的方式更改
The most basic form of _reindex
just copies documents from one index to another. This will copy documents from the twitter
index into the new_twitter
index:
_reindex的最基本形式只是将文档从一个索引复制到另一个索引。这会将twitter索引中的文档复制到new_twitter索引中:
POST /_reindex
{
"source": {
"index": "twitter"
},
"dest": {
"index": "new_twitter"
}
}
That will return something like this:
{
"took" : 147,
"timed_out": false,
"created": 120,
"updated": 0,
"batches": 1,
"version_conflicts": 0,
"failures" : [ ],
"created": 12344
}
While Reindex is running you can fetch their status using the Task API:
GET /_tasks/?pretty&detailed=true&actions=*reindex
Any Reindex can be canceled using the Task Cancel API:
POST /_tasks/{task_id}/_cancel
The task_id
can be found using the tasks API above.
具体参数设置 参考 https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-reindex.html