Search in sources :

Example 11 with JestClientFactory

use of io.searchbox.client.JestClientFactory in project xwiki-platform by xwiki.

the class DefaultJestClientManager method initialize.

@Override
public void initialize() throws InitializationException {
    String pingURL = this.configuration.getPingInstanceURL();
    HttpClientConfig clientConfig = new HttpClientConfig.Builder(pingURL).multiThreaded(true).build();
    JestClientFactory factory = new XWikiJestClientFactory(this.configuration);
    factory.setHttpClientConfig(clientConfig);
    this.client = factory.getObject();
}
Also used : HttpClientConfig(io.searchbox.client.config.HttpClientConfig) JestClientFactory(io.searchbox.client.JestClientFactory)

Example 12 with JestClientFactory

use of io.searchbox.client.JestClientFactory in project vboard by voyages-sncf-technologies.

the class ElasticSearchClient method lazyGetElsClient.

// Lazy initialization because we want to be able to instantiate this bean without an ElasticSearch server beeing available
public JestHttpClient lazyGetElsClient() {
    if (this.elasticSearchClient == null) {
        final JestClientFactory factory = new JestClientFactory();
        factory.setHttpClientConfig(new HttpClientConfig.Builder(this.elsConfig.getServerUri()).multiThreaded(true).build());
        this.elasticSearchClient = (JestHttpClient) factory.getObject();
    }
    return this.elasticSearchClient;
}
Also used : HttpClientConfig(io.searchbox.client.config.HttpClientConfig) JestClientFactory(io.searchbox.client.JestClientFactory)

Example 13 with JestClientFactory

use of io.searchbox.client.JestClientFactory in project jmxtrans by jmxtrans.

the class ElasticWriter method createJestClient.

private JestClient createJestClient(String connectionUrl, String username, String password) {
    log.info("Create a jest elastic search client for connection url [{}]", connectionUrl);
    JestClientFactory factory = new JestClientFactory();
    HttpClientConfig httpClientConfig;
    if (username != null) {
        log.info("Using HTTP Basic Authentication");
        httpClientConfig = new HttpClientConfig.Builder(connectionUrl).defaultCredentials(username, password).multiThreaded(true).build();
    } else {
        httpClientConfig = new HttpClientConfig.Builder(connectionUrl).multiThreaded(true).build();
    }
    factory.setHttpClientConfig(httpClientConfig);
    return factory.getObject();
}
Also used : HttpClientConfig(io.searchbox.client.config.HttpClientConfig) JestClientFactory(io.searchbox.client.JestClientFactory)

Example 14 with JestClientFactory

use of io.searchbox.client.JestClientFactory in project dq-easy-cloud by dq-open-cloud.

the class TransportClient method getClient.

@Before
public void getClient() throws Exception {
    JestClientFactory factory = new JestClientFactory();
    factory.setHttpClientConfig(new HttpClientConfig.Builder("http://120.78.74.169:9200").gson(new GsonBuilder().setDateFormat("yyyy-MM-dd'T'hh:mm:ss").create()).connTimeout(1500).readTimeout(3000).multiThreaded(true).build());
    jestClient = factory.getObject();
}
Also used : GsonBuilder(com.google.gson.GsonBuilder) GsonBuilder(com.google.gson.GsonBuilder) HighlightBuilder(org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder) SearchSourceBuilder(org.elasticsearch.search.builder.SearchSourceBuilder) QueryBuilder(org.elasticsearch.index.query.QueryBuilder) JestClientFactory(io.searchbox.client.JestClientFactory) Before(org.junit.Before)

Aggregations

JestClientFactory (io.searchbox.client.JestClientFactory)14 HttpClientConfig (io.searchbox.client.config.HttpClientConfig)9 JestClient (io.searchbox.client.JestClient)3 Search (io.searchbox.core.Search)3 SearchResult (io.searchbox.core.SearchResult)3 SearchSourceBuilder (org.elasticsearch.search.builder.SearchSourceBuilder)3 GsonBuilder (com.google.gson.GsonBuilder)2 Builder (io.searchbox.client.config.HttpClientConfig.Builder)2 Gson (com.google.gson.Gson)1 JestHttpClient (io.searchbox.client.http.JestHttpClient)1 Bulk (io.searchbox.core.Bulk)1 IndicesExists (io.searchbox.indices.IndicesExists)1 URL (java.net.URL)1 KeyManagementException (java.security.KeyManagementException)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 CertificateException (java.security.cert.CertificateException)1 X509Certificate (java.security.cert.X509Certificate)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1