12345678910111213141516171819202122232425262728 |
- package com.pavis.ghjesapi.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;
- /**
- * @program: test-es
- * @description: ElasticSearchConfig
- * @author: Guanzi
- * @created: 2021/09/30 16:55
- */
- @Configuration
- public class ElasticSearchConfig {
- // 注册 rest高级客户端
- @Bean
- public RestHighLevelClient restHighLevelClient() {
- RestHighLevelClient client = new RestHighLevelClient(
- RestClient.builder(
- new HttpHost("127.0.0.1", 9200, "http")
- )
- );
- return client;
- }
- }
|