springboot 整合Elasticsearch

 

Elasticsearch

Elasticsearch 是一個分佈式、可擴展、實時的搜索與數據分析引擎。 它能從項目一開始就賦予你的數據以搜索、分析和探索的能力,可用於實現全文搜索和實時數據統計。node

在pom.xml中添加相關依賴

<!--Elasticsearch相關依賴-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-elasticsearch<artifactId>
</dependency>

 

修改SpringBoot配置文件

修改application.yml文件,在spring節點下添加Elasticsearch相關配置。git

data:
  elasticsearch:
    repositories:
      enabled: true
    cluster-nodes: 127.0.0.1:9300 # es的鏈接地址及端口號
    cluster-name: elasticsearch # es集羣的名稱

 

文章詳情:https://macrozheng.github.io/mall-learning/#/architect/mall_arch_07github

相關文章
相關標籤/搜索