Search in sources :

Example 26 with RestClientBuilder

use of org.graylog.shaded.elasticsearch7.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);
}
Also used : HttpHost(org.apache.http.HttpHost) RestClientBuilder(org.elasticsearch.client.RestClientBuilder) RestHighLevelClient(org.elasticsearch.client.RestHighLevelClient)

Example 27 with RestClientBuilder

use of org.graylog.shaded.elasticsearch7.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);
}
Also used : HttpHost(org.apache.http.HttpHost) RestClientBuilder(org.elasticsearch.client.RestClientBuilder) RestHighLevelClient(org.elasticsearch.client.RestHighLevelClient)

Example 28 with RestClientBuilder

use of org.graylog.shaded.elasticsearch7.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);
}
Also used : HttpHost(org.apache.http.HttpHost) RestClientBuilder(org.elasticsearch.client.RestClientBuilder) RestHighLevelClient(org.elasticsearch.client.RestHighLevelClient)

Example 29 with RestClientBuilder

use of org.graylog.shaded.elasticsearch7.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;
}
Also used : RestClientBuilder(org.elasticsearch.client.RestClientBuilder) RestHighLevelClient(org.elasticsearch.client.RestHighLevelClient)

Example 30 with RestClientBuilder

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.RestClientBuilder in project janusgraph by JanusGraph.

the class RestClientSetup method getRestClient.

protected RestClient getRestClient(HttpHost[] hosts, Configuration config) {
    final RestClientBuilder restClientBuilder = getRestClientBuilder(hosts);
    final HttpClientConfigCallback httpClientConfigCallback = getHttpClientConfigCallback(config);
    if (httpClientConfigCallback != null) {
        restClientBuilder.setHttpClientConfigCallback(httpClientConfigCallback);
    }
    final RequestConfigCallback requestConfigCallback = getRequestConfigCallback(config);
    if (requestConfigCallback != null) {
        restClientBuilder.setRequestConfigCallback(requestConfigCallback);
    }
    return restClientBuilder.build();
}
Also used : BasicAuthHttpClientConfigCallback(org.janusgraph.diskstorage.es.rest.util.BasicAuthHttpClientConfigCallback) HttpClientConfigCallback(org.elasticsearch.client.RestClientBuilder.HttpClientConfigCallback) RestClientBuilder(org.elasticsearch.client.RestClientBuilder) RequestConfigCallback(org.elasticsearch.client.RestClientBuilder.RequestConfigCallback)

Aggregations

RestClientBuilder (org.elasticsearch.client.RestClientBuilder)34 HttpHost (org.apache.http.HttpHost)27 RestHighLevelClient (org.elasticsearch.client.RestHighLevelClient)23 RestClient (org.elasticsearch.client.RestClient)15 IOException (java.io.IOException)11 CredentialsProvider (org.apache.http.client.CredentialsProvider)11 ArrayList (java.util.ArrayList)7 UsernamePasswordCredentials (org.apache.http.auth.UsernamePasswordCredentials)7 BasicCredentialsProvider (org.apache.http.impl.client.BasicCredentialsProvider)7 File (java.io.File)6 KeyStore (java.security.KeyStore)6 List (java.util.List)6 Locale (java.util.Locale)6 Map (java.util.Map)5 StringUtils (org.apache.commons.lang.StringUtils)5 AuthSchemeProvider (org.apache.http.auth.AuthSchemeProvider)5 AuthSchemes (org.apache.http.client.config.AuthSchemes)5 Lookup (org.apache.http.config.Lookup)5 RegistryBuilder (org.apache.http.config.RegistryBuilder)5 SPNegoSchemeFactory (org.apache.http.impl.auth.SPNegoSchemeFactory)5