org.apache.flume.sink.elasticsearch.client

## Class ElasticSearchClientFactory

- java.lang.Object
- - org.apache.flume.sink.elasticsearch.client.ElasticSearchClientFactory

-     public class ElasticSearchClientFactory
      extends Object

  Internal ElasticSearch client factory. Responsible for creating instance of ElasticSearch clients.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `RestClient`
    `static String` | `TransportClient`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ElasticSearchClientFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ElasticSearchClient` | `getClient(String clientType, String[] hostNames, String clusterName, ElasticSearchEventSerializer serializer, ElasticSearchIndexRequestBuilderFactory indexBuilder)`
    `ElasticSearchClient` | `getLocalClient(String clientType, ElasticSearchEventSerializer serializer, ElasticSearchIndexRequestBuilderFactory indexBuilder)` Used for tests only.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TransportClient

          public static final String TransportClient

      See Also:
        Constant Field Values

    - #### RestClient

          public static final String RestClient

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ElasticSearchClientFactory

          public ElasticSearchClientFactory()

  - ### Method Detail

    - #### getClient

          public ElasticSearchClient getClient(String clientType,
                                      String[] hostNames,
                                      String clusterName,
                                      ElasticSearchEventSerializer serializer,
                                      ElasticSearchIndexRequestBuilderFactory indexBuilder)
                                        throws org.apache.flume.sink.elasticsearch.client.NoSuchClientTypeException

      Parameters:
        `clientType` - String representation of client type
        `hostNames` - Array of strings that represents hostnames with ports (hostname:port)
        `clusterName` - Elasticsearch cluster name used only by Transport Client
        `serializer` - Serializer of flume events to elasticsearch documents
      Returns:
      Throws:
        `org.apache.flume.sink.elasticsearch.client.NoSuchClientTypeException`

    - #### getLocalClient

          public ElasticSearchClient getLocalClient(String clientType,
                                           ElasticSearchEventSerializer serializer,
                                           ElasticSearchIndexRequestBuilderFactory indexBuilder)
                                             throws org.apache.flume.sink.elasticsearch.client.NoSuchClientTypeException

      Used for tests only. Creates local elasticsearch instance client.
      Parameters:
        `clientType` - Name of client to use
        `serializer` - Serializer for the event
        `indexBuilder` - Index builder factory
      Returns:
        Local elastic search instance client
      Throws:
        `org.apache.flume.sink.elasticsearch.client.NoSuchClientTypeException`

Copyright © 2009-2016 Apache Software Foundation. All Rights Reserved.