I use Spring Boot Starter Data Elasticsearch 2.2.3.RELEASE with Elasticsearch v6.8.6. I configured the RestHighLevelClient for the connection to the cluster.
Now I constantly get a SocketTimeoutException on different operations:
java.net.SocketTimeoutException: 5,000 milliseconds timeout on connection http-outgoing-95 [ACTIVE]
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.timeout(HttpAsyncRequestExecutor.java:387) ~[httpcore-nio-4.4.13.jar!/:4.4.13]
at org.apache.http.impl.nio.client.InternalIODispatch.onTimeout(InternalIODispatch.java:92) ~[httpasyncclient-4.1.4.jar!/:4.1.4]
at org.apache.http.impl.nio.client.InternalIODispatch.onTimeout(InternalIODispatch.java:39) ~[httpasyncclient-4.1.4.jar!/:4.1.4]
at org.apache.http.impl.nio.reactor.AbstractIODispatch.timeout(AbstractIODispatch.java:175) ~[httpcore-nio-4.4.13.jar!/:4.4.13]
at org.apache.http.impl.nio.reactor.BaseIOReactor.sessionTimedOut(BaseIOReactor.java:261) ~[httpcore-nio-4.4.13.jar!/:4.4.13]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.timeoutCheck(AbstractIOReactor.java:502) ~[httpcore-nio-4.4.13.jar!/:4.4.13]
at org.apache.http.impl.nio.reactor.BaseIOReactor.validate(BaseIOReactor.java:211) ~[httpcore-nio-4.4.13.jar!/:4.4.13]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:280) ~[httpcore-nio-4.4.13.jar!/:4.4.13]
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) ~[httpcore-nio-4.4.13.jar!/:4.4.13]
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591) ~[httpcore-nio-4.4.13.jar!/:4.4.13]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]
Can I configure the socket timeout in the Spring Boot application and if yes, where.
I tried configuring the socket timeout of the ClientConfiguration I create the RestHighLevelClient with which had no effect:
ClientConfiguration clientConfiguration = ClientConfiguration.builder()
.connectedTo(nodes)
.withSocketTimeout(Duration.ofSeconds(30))
.build();
RestHighLevelClient client = RestClients.create(clientConfiguration).rest();