ElasticSearch7.X Java client


 
 
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>7.2.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.2.0</version>
</dependency>


import org.apache.http.HttpHost; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestHighLevelClient; /** * @author * @version 1.0 * @description TODO * @date 2020/4/19 20:38 **/ public class EsClient { private static RestHighLevelClient client = null; public static synchronized RestHighLevelClient getEsClient() { if (client == null){ client = new RestHighLevelClient(RestClient.builder( new HttpHost("192.168.242.20", 9200, "http") )); } return client; } }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM