gpt4 book ai didi

elasticsearch - Spring Data Elasticsearch-如何使用ElasticsearchRestTemplate?

转载 作者:行者123 更新时间:2023-12-02 22:28:18 30 4
gpt4 key购买 nike

我有一个连接到ElasticSearch的springboot应用程序。但是,我想使用ElasticsearchRestTemplate,而我只得到classNotFound。

我的pom.xml

    <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependencies>

当我尝试导入时
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;

它表明该类不存在。如何解决呢?哪个版本的Spring Elasticsearch Data可以使用ElasticsearchRestTemplate?

最佳答案

ElasticsearchRestTemplate是仍在开发中的Spring Data ES release 4的一部分。

如果您想尝试一下(即不在生产环境中),可以使用4.0.0.BUILD-SNAPSHOT版本。

关于elasticsearch - Spring Data Elasticsearch-如何使用ElasticsearchRestTemplate?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53426785/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com