我有一个连接到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/