(1)使用es client代码库
<elasticsearch.version>2.3.3</elasticsearch.version>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
</dependency>
(2)es建议使用xml配置
spring.data.elasticsearch.cluster-name=galen #集群名称
#spring.data.elasticsearch.cluster-nodes=106.75.33.233:9200,10.10.46.196:9200,10.10.56.141:9200 多台服务器
spring.data.elasticsearch.cluster-nodes=172.16.10.70:9300 #es service url
spring.data.elasticsearch.properties.path.data= ./elasticsearch/data #es本地data
spring.data.elasticsearch.properties.path.logs= ./elasticsearch/logs #es本地日志
(3)注意事项
注意 cluster-nodes的端口号,一般都是9300,不是9200
<elasticsearch.version>2.3.3</elasticsearch.version>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
</dependency>
(2)es建议使用xml配置
spring.data.elasticsearch.cluster-name=galen #集群名称
#spring.data.elasticsearch.cluster-nodes=106.75.33.233:9200,10.10.46.196:9200,10.10.56.141:9200 多台服务器
spring.data.elasticsearch.cluster-nodes=172.16.10.70:9300 #es service url
spring.data.elasticsearch.properties.path.data= ./elasticsearch/data #es本地data
spring.data.elasticsearch.properties.path.logs= ./elasticsearch/logs #es本地日志
(3)注意事项
注意 cluster-nodes的端口号,一般都是9300,不是9200