Intermittent exception in index call

We are using Elasticsearch java, in a lambda function. The below log is in lambda
Apparently this exception is happening when you use the Elastic of other component and quickly trigger the lambda function. Any suggestions?

Request execution cancelled: java.lang.RuntimeException
java.lang.RuntimeException: Request execution cancelled
	at org.elasticsearch.client.RestClient.extractAndWrapCause(
	at org.elasticsearch.client.RestClient.performRequest(
	at org.elasticsearch.client.RestClient.performRequest(
	at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(
	at co.elastic.clients.elasticsearch.ElasticsearchClient.index(
	at co.elastic.clients.elasticsearch.ElasticsearchClient.index(
Caused by: java.util.concurrent.CancellationException: Request execution cancelled
	at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.execute(
	at org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(
	at org.elasticsearch.client.RestClient.performRequest(

Thanks in advance

I managed to solve this by myself. The problem was that I was opening a connection with Elastic Search and never closing it.

So actually was working only for the first time and when trigger for the second that I already had the connection opened this problem happened.

The solution in this case was making sure every connection with ES has been closed after using it.

1 Like

Getting similar exception. Can you explain and show some code snippet that how are you "closing the connection?"

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