本文章主要介绍SpringBoot集成elasticsearch进行全文检索的功能处理。
一、首先是yml配置文件进行数据配置如下模式。
spring:
elasticsearch:
rest:
uris: http://127.0.0.1:9300
# cluster.nodes: hadoop137:9300,hadoop138:9300,hadoop139:9300
1、cluster.nodes: 127.0.0.1:9300是配置的本地模式。
2、cluster.nodes: hadoop137:9300,hadoop138:9300,hadoop139:9300是配置的集群模式
ps:我这里采用的是配置的本地模式
二、需要引入对应的elasticsearch的依赖,请注意SpringBoot对应的elasticsearch版本,对应关系如下:
我是用的是2.3.12的Springboot,7.6.2的elasticsearch,知道了对应版本关系就需要引入对应的依赖了在你的pom.xml下添加如下依赖:
org.springframework.boot spring-boot-starter-data-elastic



