RestClient 6.1 getting Connection reset by peer error while querying ES


(Arun Kumar) #1

I am getting " Connection reset by peer" error while querying ES. after few re-tries its working fine.
private static RestHighLevelClient client;

     RestClientBuilder builder = RestClient.builder(new HttpHost(hostname, 9200, "http"));
			builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
                @Override
                public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
                    return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
                }
            });		
		client = new RestHighLevelClient(builder);

The exception is too big to share here. Is there another way that i can upload the exception?

The connection is established by

private static RestHighLevelClient getRestInstance() throws exception{
	
		if (client == null) {

			initializeRestClient();  //this calls the restClientbuilder to initialize the connection. 
		}
		return client;
	}

Search
searchResponse = getRestInstance().search(searchRequest); // this line throws the exception.


(system) #3

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