I am am having a hell of a time trying to get started with the ES Java API using the instructions on the official doc
I install it as instructed here, i.e., I put this in my pom.xml file:
<dependency>
<groupId>co.elastic.clients</groupId>
<artifactId>elasticsearch-java</artifactId>
<version>8.5.3</version>
</dependency>
But when I run mvn, it does not find the dependency:
Could not find artifact co.elastic.clients:elasticsearch-java:jar:8.5.3 in central (Central Repository:)
So I modify the dependency to use 8.5.2 (which as I understand is the latest stable version). This time, maven does find the dependency, but when I write code that tries to connect to ES as per this page, maven complains that it can't find the RestClient class.
After much searching and poking around, I notice a section way at the end of the official doc about the Low level Rest API.
So I follow the instructions there and add this to my pom.xml:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>8.5.2</version>
</dependency>
This time, Maven finds the RestClient class.
SUGGESTION: This dependency really should be mentioned at the BEGINNING of the doc, not the very end. It took me several hours of poking around before I noticed that.
But I am not out of the woods yet, because even though the program compiles with Mavenm, when I try to run it, I get:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/HttpHost
Please help.
Thx.