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

标签 elasticsearch spring-data-elasticsearch

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

相关文章:

spring-data - 如何使用 Spring Data 为 Elastic Search 设置 _id 字段

regex - 在Graylog中搜索带有破折号和数字的字符串?

rest - 如何在Rest API中使用Kibana查询

elasticsearch - 在 Google Compute Engine 上使用抢占式虚拟机

Python日志分析工具/库

elasticsearch - Spring Elasticsearch-检索在字段中具有最大值(value)的文档

spring-boot - 在使用spring-boot 2.3的同时选择spring-data-elasticsearch 3.2

elasticsearch - 如何从elasticsearch的默认_英语_停用词列表中删除停用词?

java - 无法使用 Java API 在 ElasticSearch 1.7.3 中索引 GeoPoints

java - 是否可以在 spring-data-elasticsearch 中将 Completion 字段与 Context Suggester 映射?