前言:演示版本为7.6.1

一、SpringBoot整合ElasticSearch

1. 添加文件ElasticSearchConfig

package com.tm.es.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ElasticSearchConfig {
    @Bean
    public RestHighLevelClient restHighLevelClient    (){
        RestHighLevelClient    client = new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost("localhost",9200,"http")));
        return client;
    }
}
ElasticSearchConfig

相关文章:

  • 2021-11-12
  • 2022-02-24
  • 2021-09-14
  • 2021-05-24
  • 2021-11-29
  • 2021-09-16
  • 2021-07-11
  • 2021-05-08
猜你喜欢
  • 2022-12-23
  • 2021-04-10
  • 2022-12-23
  • 2021-11-20
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案