use of org.elasticsearch.client.RestHighLevelClient 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.RestHighLevelClient 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.RestHighLevelClient 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.RestHighLevelClient 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;
}
use of org.elasticsearch.client.RestHighLevelClient in project jnosql-diana-driver by eclipse.
the class ElasticsearchDocumentConfiguration method get.
@Override
public ElasticsearchDocumentCollectionManagerFactory get(Settings settings) throws NullPointerException {
requireNonNull(settings, "settings is required");
Map<String, String> configurations = new HashMap<>();
settings.forEach((key, value) -> configurations.put(key, value.toString()));
configurations.keySet().stream().filter(k -> k.startsWith(HOST_PREFIX)).sorted().map(h -> ElasticsearchAddress.of(configurations.get(h), DEFAULT_PORT)).map(ElasticsearchAddress::toHttpHost).forEach(httpHosts::add);
RestClientBuilder builder = RestClient.builder(httpHosts.toArray(new HttpHost[httpHosts.size()]));
builder.setDefaultHeaders(headers.stream().toArray(Header[]::new));
String maxRetry = configurations.get("elasticsearch-maxRetryTimeoutMillis");
if (maxRetry != null) {
maxRetryTimoutMillis = Integer.valueOf(maxRetry);
}
builder.setMaxRetryTimeoutMillis(maxRetryTimoutMillis);
RestHighLevelClient client = new RestHighLevelClient(builder);
return new ElasticsearchDocumentCollectionManagerFactory(client);
}
Aggregations