在Elasticsearch中,你可以使用 `_tasks` API 来检查 `_reindex` 任务的状态。当你发起一个 `_reindex` 请求时,Elasticsearch 会返回一个任务 ID,你可以使用这个任务 ID 来查询任务的详细状态。
以下是如何检查 `_reindex` 任务状态的步骤:
### 1. 获取任务 ID
首先,你需要获取 `_reindex` 任务的 ID。当你发送 `_reindex` 请求时,Elasticsearch 会返回一个响应,其中包含任务 ID。例如:
```json
POST _reindex
{
"source": {
"index": "kibana_sample_data_logs",
"size": 50
},
"dest": {
"index": "lang-test",
"pipeline": "my-lang-pipeline"
}
}
```
响应可能类似于:
```