1.2 配置信息 这里根据elasticsearch服务端的地址进行配置: @Configuration public class ElasticSearchConfig { @Bean public RestHighLevelClient restHighLevelClient() { RestHighLevelClient client = new RestHighLevelClient( RestClient.builder( new HttpHost("127.0.0.1", 9200, "http") )); return client; ...
RestClient.builder(new HttpHost("localhost", 9200, "http"), new HttpHost("localhost", 9201, "http"), new HttpHost("localhost", 9202, "http"))); 1. 2. 3. 这种写法有以下缺点 1.和通用的使用配置的方式不同(写死到代码中,无法灵活变动), 2.也不适用于生产环境ElasticSearch集群的调用(生产...