Timeout Error using the ReIndex API

We are using ES 5.6 and trying to use Reindex API to copy documents from one Index to another. Both the Index are in the same cluster. When we are using the API for a type which had large number to documents we are facing a timeout error.
We have used a batch size of 5000.

POST _reindex
{
  "source": {
"index": ["source-index-name"],
"type": ["type"],
"size": 5000
  },
  "dest": {
"index": "destination-index-name"
  }
}

We are getting the following error:

{
  "statusCode": 504,
  "error": "Gateway Timeout",
  "message": "Client request timeout"
}
2 Likes

Its because the Reindex API call, by default, awaits the background reindex task to finish, but if you are calling this from Kibana, then Kibana will break the request at 30s mark. Yet, the reindex task still continues on the background.

If you wish that the command returns right away after the call yiu need to include ?wait_for_completion=false

10 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.