I am trying to follow the example at https://www.baeldung.com/elasticsearch-java But I am afraid there might be missing dependencies, as already in the first lines of code, my IDE is not being able to find the import for ClientConfiguration and RestClients, only for RestHighLevelClient. I already added even more elasticsearch dependencies to my pom, but still same issue. My POM currently contains:
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>7.6.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.6.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>7.6.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>7.6.2</version>
</dependency>
Could you please advise?
Thank you in advance.
CodePudding user response:
This worked for me, seems to be part of the Spring data elastic search.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>4.2.5</version>
</dependency>
CodePudding user response:
I already figured it out, but found useful to post it here, just in case. Indeed the article doesn't make clear there are other springframwork required dependencies, but you can find them in the very end, as it has a Github link, where you can see those classes come from:
import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.RestClients;
Pom file direct link: https://github.com/eugenp/tutorials/blob/master/persistence-modules/spring-data-elasticsearch/pom.xml