SpringBoot整合ES
基本步骤
-  
访问自己的ES网址,得到cluster_name:

注意:spring的依赖包elasticsearch与ES版本基本要保持一致,这里是6.8.6 -  
springBoot的核心配置文件
spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=192.168.1.12:9301
 
常见错误
1.   Unable to identify index name. Book is not a Document
解决:@Document(indexName="lxw",type = "book")//声明是一个文档
2.No id property found for class com.lxw.study.pojo.Book!
解决:在实体类的Id属性上使用@Id注解即可
 

注意:这个clster-name不要写错:写错了会报
NoNodeAvailableException[None of the configured nodes are available:
 原因就是写错了ES集群的名称,从而没找到这个集群
 
 之前写的cluster-name=elasticsearch










