use of org.elasticsearch.client.RestClientBuilder in project ranger by apache.
the class ElasticSearchIndexBootStrapper method createClient.
private void createClient() {
try {
RestClientBuilder restClientBuilder = getRestClientBuilder(hosts, protocol, user, password, port);
client = new RestHighLevelClient(restClientBuilder);
} catch (Throwable t) {
lastLoggedAt.updateAndGet(lastLoggedAt -> {
long now = System.currentTimeMillis();
long elapsed = now - lastLoggedAt;
if (elapsed > TimeUnit.MINUTES.toMillis(1)) {
LOG.severe("Can't connect to ElasticSearch server: " + connectionString() + t);
return now;
} else {
return lastLoggedAt;
}
});
}
}
use of org.elasticsearch.client.RestClientBuilder in project pancm_project by xuwujing.
the class EsParticipleSearchTest method init.
/*
* 初始化服务
*/
private static void init() {
RestClientBuilder restClientBuilder = RestClient.builder(new HttpHost(elasticIp, elasticPort));
client = new RestHighLevelClient(restClientBuilder);
}
use of org.elasticsearch.client.RestClientBuilder in project pancm_project by xuwujing.
the class EsAggregationSearchTest method init.
/*
* 初始化服务
*/
private static void init() {
RestClientBuilder restClientBuilder = RestClient.builder(new HttpHost(elasticIp, elasticPort));
client = new RestHighLevelClient(restClientBuilder);
}
use of org.elasticsearch.client.RestClientBuilder in project pancm_project by xuwujing.
the class EsAggregationSearchTest2 method init.
/*
* 初始化服务
*/
private static void init() {
RestClientBuilder restClientBuilder = RestClient.builder(new HttpHost(elasticIp, elasticPort));
client = new RestHighLevelClient(restClientBuilder);
}
use of org.elasticsearch.client.RestClientBuilder in project pancm_project by xuwujing.
the class IpHandler method init.
/*
* 初始化服务
*/
private static RestHighLevelClient init() {
if (client == null) {
synchronized (EsUtil.class) {
if (client == null) {
RestClientBuilder restClientBuilder = RestClient.builder(httpHosts);
client = new RestHighLevelClient(restClientBuilder);
}
}
}
return client;
}
Aggregations