I am facing this issue, where my app tried to send search requests to es and encounters this issue.
my client config is -
> RestClientBuilder restClientBuilder = RestClient.builder(new HttpHost(elasticSearchProps.getHost(),
> elasticSearchProps.getPort(), elasticSearchProps.getScheme()));
>
> restClientBuilder.setCompressionEnabled(true);
>
>
> if (elasticSearchProps.getAuthenticationRequired()) {
> final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
>
> credentialsProvider.setCredentials(AuthScope.ANY,
> new UsernamePasswordCredentials(elasticSearchProps.getUsername(), elasticSearchProps.getPassword()));
>
> restClientBuilder.setHttpClientConfigCallback(
> httpClientBuilder -> httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider));
> }
>
> ElasticsearchTransport transport = new RestClientTransport(restClientBuilder.build(), new JacksonJsonpMapper());
>
> RequestConfig requestConfig = RequestConfig.DEFAULT;
> RequestOptions.Builder requestOptionsBuilder = RequestOptions.DEFAULT
> .toBuilder()
> .setRequestConfig(requestConfig);
>
> requestOptionsBuilder.setHttpAsyncResponseConsumerFactory(
> new HttpAsyncResponseConsumerFactory.HeapBufferedResponseConsumerFactory(
> 104857600
> )
> );
>
> return new ElasticsearchClient(transport, new RestClientOptions(requestOptionsBuilder.build()));
The no. of request being made is considerably high.
How ever there are other search operation, delete, index operations that are working but I am getting this error from a method where i am search the index with track total hits as true to get total count of the doc matching the query.
Am i doing something wrong here?
implementation("co.elastic.clients:elasticsearch-java:8.5.2")
elastic clustor version - 8.5.2
This exception happens when the http client encountered an Error (and not only an Exception) when calling a response listener. A frequent cause for this is an OutOfMemoryError happening in these listeners.
I added the SafeConsumerResponse file in my project and configured the transport to use the SafeConsumerRepsonse.Default_Options as mentioned in the document.
I still see the same error in the logs on aplication startup.
You mentioned this issue can be caused by OutOfMemoryError, but i dont see any logs indication this. Could the error be because of something else?
Adding some stack trace where I am getting the Request execution cancelled.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.