We are re-indexing some indices with an updated field mapping. The approach taken is to create a new index with the updated mapping, then copy the existing index into the new index using the Reindex API.
Code
#create empty index with updated mapping
PUT /newindex
{
"mappings": {
…
}
}
#re-index data to the newer index:
POST _reindex
{
"source": {
"index": "oldindex"
},
"dest": {
"index": "newindex"
}
This approach leads to new index being created with the updated mapping most of the times. However, sometimes the reindexing process gets stuck and the new index remains incomplete i.e., the total document count remains lower than that of the old index. Regardless of the outcome, the following error is seen on the console (Kibana dev tools) as the output of the reindex API call:
{
"error": {
"root_cause": [
{
"type": "parse_exception",
"reason": "request body is required"
}
],
"type": "parse_exception",
"reason": "request body is required"
},
"status": 400
}
We’ve tried to follow the official elastic documentation, there are no extra spaces or tabs in the command. There is no errors seen in the elasticsearch logs.
Is there any command to check the status of the reindex API call?
We tried running the following command:
GET _tasks?actions=*reindex&detailed
It returns:
{
"nodes": {}
}
Is there a way to restart re-index API calls that are stuck?