Spring Data Elasticsearch - 如何使用ElasticsearchRestTemplate?
Spring Data Elasticsearch - how to use ElasticsearchRestTemplate?
我有一个连接到 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;
说明class不存在。如何解决?哪个版本的 Spring Elasticsearch Data 可以使用 ElasticsearchRestTemplate?
ElasticsearchRestTemplate 是 Spring Data ES 的 release 4 的一部分,仍在开发中。
如果您想试用(即未投入生产),您可以使用 4.0.0.BUILD-SNAPSHOT
版本。
我有一个连接到 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;
说明class不存在。如何解决?哪个版本的 Spring Elasticsearch Data 可以使用 ElasticsearchRestTemplate?
ElasticsearchRestTemplate 是 Spring Data ES 的 release 4 的一部分,仍在开发中。
如果您想试用(即未投入生产),您可以使用 4.0.0.BUILD-SNAPSHOT
版本。