Elasticsearch-java dependency on httpclient

I have been working with Elasticsearch as a developer for a couple of years now and have successfully written some NiFi services that use the now deprecated Java API that uses port 9300 to query/retrieve/delete records to/from elasticsearch. I am currently undergoing an effort to migrate to the most recent elasticsearch-java API 8.5.3 which uses port 9200. The associated jar file depends on httpclient. In my pom.xml file, I am specifying httpclient 4.5.13 as I have seen some other traffic on the internet (spring boot - elasticsearch java.lang.NoSuchMethodError: org.apache.http.client.utils.URLEncodedUtils.formatSegments - Stack Overflow) stating version 4.5.13 solves their problem that is very similar to the one I am experiencing.

Does anyone know the correct minimum version of httpclient that the Java API 8.5.3 requires to run properly?

Here is the relevant stack trace that I am experiencing:

java.lang.NoSuchMethodError: 'java.lang.String org.apache.http.client.utils.URLEncodedUtils.formatSegments(java.lang.String[])'
        at co.elastic.clients.transport.endpoints.SimpleEndpoint.pathEncode(SimpleEndpoint.java:91)
        at co.elastic.clients.elasticsearch.core.IndexRequest.lambda$static$2(IndexRequest.java:611)
        at co.elastic.clients.transport.endpoints.EndpointBase.requestUrl(EndpointBase.java:79)
        at co.elastic.clients.transport.rest_client.RestClientTransport.prepareLowLevelRequest(RestClientTransport.java:192)
        at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:146)
        at co.elastic.clients.elasticsearch.ElasticsearchClient.index(ElasticsearchClient.java:962)

As per


@swallez might know more.

Thank you!

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