Elasticsearch Java Client 9.0.4
Discover what changed in the 9.0.4 version of the java client.
Added callbacks to Rest5Client builder
Rest5ClientBuilder now has the same level of in depth configuration the Legacy RestClientBuilder has, allowing to customize the underlying Apache HttpClient through callback functions; for example, this is how to configure the IOReactor's thread count:
Rest5ClientBuilder builder = Rest5Client
.builder(new HttpHost("localhost", 9200))
.setHttpClientConfigCallback(c -> c
.setIOReactorConfig(IOReactorConfig.custom()
.setIoThreadCount(1).build()
)
);
And this is how to customize the response timeout:
Rest5ClientBuilder builder = Rest5Client
.builder(new HttpHost("localhost", 9200))
.setRequestConfigCallback(r -> r
.setConnectTimeout(Timeout.of(5000, TimeUnit.MILLISECONDS))
.setResponseTimeout(Timeout.of(30000, TimeUnit.MILLISECONDS))
.build()
);