Skip to content

Instantly share code, notes, and snippets.

@parthmistry
Last active August 3, 2022 02:45
Show Gist options
  • Save parthmistry/5456737b5fff4afa7dde3a831740ce4f to your computer and use it in GitHub Desktop.
Save parthmistry/5456737b5fff4afa7dde3a831740ce4f to your computer and use it in GitHub Desktop.
Customize connection pool settings for Elasticsearch Java API Client
var restClient = RestClient.builder(new HttpHost("SERVER_HOST", SERVER_PORT))
.setHttpClientConfigCallback(clientConfigCallback -> {
return clientConfigCallback.setMaxConnPerRoute(50).setMaxConnTotal(50);
}).build();
var restClientTransport = new RestClientTransport(restClient, new JacksonJsonpMapper());
var elasticsearchClient = new ElasticsearchAsyncClient(restClientTransport);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment