如何使用Spring Data Rest设置Elasticsearch

时间:2019-06-14 00:54:06

标签: java spring elasticsearch spring-data-rest

我已经在spring应用程序中配置了弹性搜索。我收到此错误

failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{HDL7B1PCRyGKjqp98KTGZw}{localhost}{127.0.0.1:9300}]

我还没有在网上看到任何文章或视频来做这样的事情。这是我的设置

application.props

spring.data.elasticsearch.cluster-nodes=localhost:9300
server.port=8086

实体

@Document(indexName = "items", type = "items")
public class Item {

    @Id
    private Integer id;
    private Integer customerId;
    private Integer sku;
    private Integer quantity;
    private String message;

依赖项

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
    </dependency>
</dependencies>

你知道我在做什么错吗?

0 个答案:

没有答案