# RestHighLevelClient Reindex Timeout

**URL:** <https://discuss.elastic.co/t/resthighlevelclient-reindex-timeout/209728>\
**Category:** Elasticsearch\
**Created:** [November 27, 2019, 4:34pm UTC](https://discuss.elastic.co/t/resthighlevelclient-reindex-timeout/209728 "2019-11-27T16:34:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Escalus](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@Escalus](https://discuss.elastic.co/u/Escalus)\
**Post date:** [November 27, 2019, 4:34pm UTC](https://discuss.elastic.co/t/resthighlevelclient-reindex-timeout/209728/1 "2019-11-27T16:34:42Z")

</div>

Hello,  
I have a java client that invokes a reindex in our database. The old version used the transport client and locked like this:

```
Settings settings = Settings.builder()
		.put("client.transport.sniff", true)
		.put("client.transport.ignore_cluster_name", true)
		.build();
PreBuiltTransportClient tc = new PreBuiltTransportClient(settings);
    		
tc.addTransportAddress(new TransportAddress(InetAddress.getByName(host), port));
    		
BulkByScrollResponse response =
		new ReindexRequestBuilder(tc, ReindexAction.INSTANCE)
			 .source(sourceIndex)
			 .destination(targetIndex).get(new TimeValue(432000000));
    		
logger.info("ReIndex Finished: "+ response.getStatus());

```

This code waits until the reindex is finished(or 5 Days ^^) and returns the status.

Now I tried to convert this to the RestHighLevelClient but it times out after 30 sec with this exception:  
`ReIndex Failed: 30,000 milliseconds timeout on connection http-outgoing-0 [ACTIVE]`

Here the new version:

```
RestHighLevelClient client = ElasticClientFactory.instance().getRestHighLevelClient(searchConf);
		
ReindexRequest request = new ReindexRequest(); 
request.setSourceIndices(sourceIndex); 
request.setDestIndex(targetIndex);  
request.setTimeout(TimeValue.timeValueHours(24));
request.setRefresh(true);
BulkByScrollResponse bulkResponse = client.reindex(request, RequestOptions.DEFAULT);
		
logger.info("ReIndex Finished: "+ bulkResponse.getStatus());

```

I set the timeout in the request to 24 hours but it doesnt work.  
The client.reindexAsync listener also a exception after 30 sec.  
How can I increase the timeout?

Im on Elasticsearch version 7.4.2

---

<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:** [December 25, 2019, 4:34pm UTC](https://discuss.elastic.co/t/resthighlevelclient-reindex-timeout/209728/2 "2019-12-25T16:34:45Z")

</div>

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