EsConfig.java 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. //package com.fdkankan.tracking.config;
  2. //
  3. //import org.apache.http.HttpHost;
  4. //import org.elasticsearch.client.RestClient;
  5. //import org.elasticsearch.client.RestClientBuilder;
  6. //import org.elasticsearch.client.RestHighLevelClient;
  7. //import org.springframework.beans.factory.annotation.Autowired;
  8. //import org.springframework.beans.factory.annotation.Value;
  9. //import org.springframework.context.annotation.Bean;
  10. //import org.springframework.context.annotation.Configuration;
  11. //
  12. //@Configuration
  13. //public class EsConfig {
  14. //
  15. // @Value("${es.host}")
  16. // private String host;
  17. // @Value("${es.port}")
  18. // private int port;
  19. // @Value("${es.scheme}")
  20. // private String scheme;
  21. //
  22. // //把方法返回的对象交予spring容器管理
  23. // @Bean
  24. // public RestHighLevelClient restHighLevelClient(){
  25. // HttpHost httpHost=new HttpHost(host,port,scheme);
  26. // RestClientBuilder restClientBuilder = RestClient.builder(httpHost);
  27. // RestHighLevelClient restHighLevelClient = new RestHighLevelClient(restClientBuilder);
  28. // return restHighLevelClient;
  29. // }
  30. //
  31. //}