# Timeout Error using the ReIndex API

**URL:** <https://discuss.elastic.co/t/timeout-error-using-the-reindex-api/124333>\
**Category:** Elasticsearch\
**Created:** [March 16, 2018, 4:46pm UTC](https://discuss.elastic.co/t/timeout-error-using-the-reindex-api/124333 "2018-03-16T16:46:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![code\_blue](https://avatars.discourse-cdn.com/v4/letter/c/7ea924/32.png) [@code\_blue](https://discuss.elastic.co/u/code_blue)\
**Post date:** [March 16, 2018, 4:46pm UTC](https://discuss.elastic.co/t/timeout-error-using-the-reindex-api/124333/1 "2018-03-16T16:46:58Z")

</div>

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"
}
```

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [March 20, 2018, 3:12am UTC](https://discuss.elastic.co/t/timeout-error-using-the-reindex-api/124333/2 "2018-03-20T03:12:42Z")

</div>

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 you need to include `?wait_for_completion=false`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 17, 2018, 3:12am UTC](https://discuss.elastic.co/t/timeout-error-using-the-reindex-api/124333/3 "2018-04-17T03:12:54Z")

</div>

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