SpringCloud中使用ES

创建一个微服务

导入包pom

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

yml中开启

spring:
  application:
    name: hrm-es-server
  data:
    elasticsearch:
      cluster-name: elasticsearch
      cluster-nodes: 127.0.0.1:9300 #9200是图形界面端,9300代码端

 

上一篇:docker 安装Elssticsearch


下一篇:docker镜像elasticsearch