Timout error when using Rest Client multiple times in production

public RestClient build() {
            if (this.failureListener == null) {
                this.failureListener = new FailureListener();
            }
            CloseableHttpAsyncClient httpClient = this.createHttpClient();
            RestClient restClient = new RestClient(httpClient, (long)this.maxRetryTimeout, this.defaultHeaders, this.hosts, this.pathPrefix, this.failureListener);
            httpClient.start();
            return restClient;
        }

com.repository.exception.RepositoryServicesException: java.lang.RuntimeException: error while performing request
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at com...enterpriseimaging.documentapi.service.impl.DocumentSearchServiceImpl$$EnhancerBySpringCGLIB$$83151592.searchDocument(<generated>) ~[classes!/:0.0.739]

at com...enterpriseimaging.documentapi.rest.v3.DocumentResource.lambda$asyncGetList$2(DocumentResource.java:166) ~[classes!/:0.0.739]

at com.....engine.core.concurrent.FunctionRequestContextHandlerBaseImpl.copyScope(FunctionRequestContextHandlerBaseImpl.java:50) [.-core-concurrency-2.8.3.RELEASE.jar!/:?]

at com.....engine.core.concurrent.FunctionRequestContextHandlerBaseImpl.copyScope(FunctionRequestContextHandlerBaseImpl.java:64) [.-core-concurrency-2.8.3.RELEASE.jar!/:?]

at com.....engine.core.concurrent.RequestContextAwareCallable.call(RequestContextAwareCallable.java:57) [.-core-concurrency-2.8.3.RELEASE.jar!/:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_191]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_191]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]

Caused by: java.lang.RuntimeException: error while performing request

at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:681) ~[elasticsearch-rest-client-5.6.4.jar!/:5.6.4]

at org.elasticsearch.client.RestClient.performRequest(RestClient.java:219) ~[elasticsearch-rest-client-5.6.4.jar!/:5.6.4]

at org.elasticsearch.client.RestClient.performRequest(RestClient.java:191) ~[elasticsearch-rest-client-5.6.4.jar!/:5.6.4]

at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:396) ~[elasticsearch-rest-high-level-client-5.6.4.jar!/:5.6.4]

at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:382) ~[elasticsearch-rest-high-level-client-5.6.4.jar!/:5.6.4]

at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:323) ~[elasticsearch-rest-high-level-client-5.6.4.jar!/:5.6.4]

at com...enterpriseimaging.repository.dao.impl.RepositoryDAOImpl.executeRestSearchQuery(RepositoryDAOImpl.java:268) ~[ei-repository-library-0.0.68.jar!/:?]

at com...enterpriseimaging.repository.dao.impl.RepositoryDAOImpl.lambda$searchRepository$0(RepositoryDAOImpl.java:132) ~[ei-repository-library-0.0.68.jar!/:?]

at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) ~[?:1.8.0_191]

... 1 more
Caused by: java.util.concurrent.TimeoutException

        at org.apache.http.nio.pool.AbstractNIOConnPool.processPendingRequest(AbstractNIOConnPool.java:364) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.nio.pool.AbstractNIOConnPool.processNextPendingRequest(AbstractNIOConnPool.java:344) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.nio.pool.AbstractNIOConnPool.release(AbstractNIOConnPool.java:318) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.releaseConnection(PoolingNHttpClientConnectionManager.java:391) ~[httpasyncclient-4.1.4.jar!/:4.1.4]

        at org.apache.http.impl.nio.client.AbstractClientExchangeHandler.releaseConnection(AbstractClientExchangeHandler.java:245) ~[httpasyncclient-4.1.4.jar!/:4.1.4]

        at org.apache.http.impl.nio.client.MainClientExec.responseCompleted(MainClientExec.java:387) ~[httpasyncclient-4.1.4.jar!/:4.1.4]

        at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:172) ~[httpasyncclient-4.1.4.jar!/:4.1.4]

        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:326) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81) ~[httpasyncclient-4.1.4.jar!/:4.1.4]

        at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39) ~[httpasyncclient-4.1.4.jar!/:4.1.4]

        at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:121) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588) ~[httpcore-nio-4.4.5.jar!/:4.4.5]

        ... 1 more

What is timing out in this error. It is timing out to connect to Elastic?

Hard to tell with the little info that you provided, but it could be that it's timing out connecting to Elastic. The version that you are using is a bit outdated in the way timeouts are handled though. I would recommend to update the low-level client version that you are using. If you use only low-level client, its version does not have to match the server version.