Search code examples
javamavenopensearch

How to add spring data opensearch to java maven project


I want to add this library https://github.com/opensearch-project/spring-data-opensearch to my project

I added dependency:

<dependency>
    <groupId>org.opensearch.client</groupId>
    <artifactId>spring-data-opensearch</artifactId>
    <version>3.0.0-SNAPSHOT</version>
</dependency>

And add repo:

<repositories>
    <repository>
        <id>opensearch-libs-snapshot</id>
        <name>AWS Snapshot Repository</name>
        <url>https://aws.oss.sonatype.org/content/repositories/snapshots/</url>
    </repository>
</repositories>

I see this error:

Failure to find org.opensearch.client:spring-data-opensearch:jar:3.0.0-SNAPSHOT in https://aws.oss.sonatype.org/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of opensearch-libs-snapshot has elapsed or updates are forced

Solution

  • spring-data-opensearch 1.0.0 is released.

    Quoting from the README

    At the moment, Spring Data OpenSearch provides the possibility to use the RestHighLevelCLient to connect to OpenSearch clusters.

    <dependency>
      <groupId>org.opensearch.client</groupId>
      <artifactId>spring-data-opensearch</artifactId>
      <version>1.0.0</version>
    </dependency>
    

    To use Spring Boot 3.x auto configuration support:

    <dependency>
      <groupId>org.opensearch.client</groupId>
      <artifactId>spring-data-opensearch-starter</artifactId>
      <version>1.0.0</version>
    </dependency>
    

    To use Spring Boot 3.x auto configuration support for testing:

    <dependency>
      <groupId>org.opensearch.client</groupId>
      <artifactId>spring-data-opensearch-test-autoconfigure</artifactId>
      <version>1.0.0</version>
      <scope>test</scope>
    </dependency>