一、使用前设置
1、elasticsearch开启
cmd下,进入安装目录
cd D:\developToool\elasticsearch-5.4.3
elasticsearch
# 或者后台运行
elasticsearch -d
校验安装成功:http://127.0.0.1:9200/
查看集群健康:http://127.0.0.1:9200/_cat/health?v
查看集群节点:http://127.0.0.1:9200/_cat/nodes?v
查看索引信息:http://127.0.0.1:9200/_cat/indices?v
2、elasticsearch-header
cd D:\developToool\elasticsearch-head
npm run start
二、spring对接
由于服务器端版本使用5.4.3。故客户端使用此版本
环境配置
ES版本:5.4.3
spring-data-elasticsearch:3.0.0.RELEASE
spring:5.0.1.RELEASE
2.1、maven配置
<dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>transport</artifactId> <version>${es.version}</version> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-elasticsearch</artifactId> <version>${spring.es.version}</version> <exclusions> <exclusion> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> </exclusion> <exclusion> <groupId>org.elasticsearch.client</groupId> <artifactId>transport</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> </exclusion> </exclusions> </dependency>