Java client hangs


I am writing a Java program to work with Elasticsearch server.
My Java client version is 7.17.4, server version is 7.17.0.
Consider the following code:

RestClient restClient = RestClient.builder(new HttpHost("", 9200, "https")).build();
ElasticsearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());
ElasticsearchIndicesClient indicesClient = new ElasticsearchIndicesClient(transport);
indicesClient.delete(b -> b.index("non-existent-index"));

I see the following exception on console (pretty valid):

Exception in thread "main" co.elastic.clients.elasticsearch._types.ElasticsearchException: [es/indices.delete] failed: [index_not_found_exception] no such index [non-existent-index]
	at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(
	at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(
	at co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient.delete(
	at co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient.delete(

but the program hungs forever.


Thanks in advance.

You have to call transport.close(): the http client internally contains a pool of open connections and associated threads.

Indeed, thanks a lot!

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