RestHighLevelClient Reindex Timeout

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

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