org.apache.flume.sink.elasticsearch.client
Class ElasticSearchTransportClient

java.lang.Object
  extended by org.apache.flume.sink.elasticsearch.client.ElasticSearchTransportClient
All Implemented Interfaces:
Configurable, ElasticSearchClient

public class ElasticSearchTransportClient
extends Object
implements ElasticSearchClient


Field Summary
static org.slf4j.Logger logger
           
 
Constructor Summary
ElasticSearchTransportClient(org.elasticsearch.client.Client client, ElasticSearchEventSerializer serializer)
          Used for testing
ElasticSearchTransportClient(org.elasticsearch.client.Client client, ElasticSearchIndexRequestBuilderFactory requestBuilderFactory)
          Used for testing
ElasticSearchTransportClient(ElasticSearchEventSerializer serializer)
          Local transport client only for testing
ElasticSearchTransportClient(ElasticSearchIndexRequestBuilderFactory indexBuilderFactory)
          Local transport client only for testing
ElasticSearchTransportClient(String[] hostNames, String clusterName, ElasticSearchEventSerializer serializer)
          Transport client for external cluster
ElasticSearchTransportClient(String[] hostNames, String clusterName, ElasticSearchIndexRequestBuilderFactory indexBuilder)
           
 
Method Summary
 void addEvent(Event event, IndexNameBuilder indexNameBuilder, String indexType, long ttlMs)
          Add new event to the bulk
 void close()
          Close connection to elastic search in client
 void configure(Context context)
           Request the implementing class to (re)configure itself.
 void execute()
          Sends bulk to the elasticsearch cluster
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final org.slf4j.Logger logger
Constructor Detail

ElasticSearchTransportClient

public ElasticSearchTransportClient(String[] hostNames,
                                    String clusterName,
                                    ElasticSearchEventSerializer serializer)
Transport client for external cluster

Parameters:
hostNames -
clusterName -
serializer -

ElasticSearchTransportClient

public ElasticSearchTransportClient(String[] hostNames,
                                    String clusterName,
                                    ElasticSearchIndexRequestBuilderFactory indexBuilder)

ElasticSearchTransportClient

public ElasticSearchTransportClient(ElasticSearchIndexRequestBuilderFactory indexBuilderFactory)
Local transport client only for testing

Parameters:
indexBuilderFactory -

ElasticSearchTransportClient

public ElasticSearchTransportClient(ElasticSearchEventSerializer serializer)
Local transport client only for testing

Parameters:
serializer -

ElasticSearchTransportClient

public ElasticSearchTransportClient(org.elasticsearch.client.Client client,
                                    ElasticSearchEventSerializer serializer)
Used for testing

Parameters:
client - ElasticSearch Client
serializer - Event Serializer

ElasticSearchTransportClient

public ElasticSearchTransportClient(org.elasticsearch.client.Client client,
                                    ElasticSearchIndexRequestBuilderFactory requestBuilderFactory)
                             throws IOException
Used for testing

Parameters:
client - ElasticSearch Client
serializer - Event Serializer
Throws:
IOException
Method Detail

close

public void close()
Description copied from interface: ElasticSearchClient
Close connection to elastic search in client

Specified by:
close in interface ElasticSearchClient

addEvent

public void addEvent(Event event,
                     IndexNameBuilder indexNameBuilder,
                     String indexType,
                     long ttlMs)
              throws Exception
Description copied from interface: ElasticSearchClient
Add new event to the bulk

Specified by:
addEvent in interface ElasticSearchClient
Parameters:
event - Flume Event
indexNameBuilder - Index name builder which generates name of index to feed
indexType - Name of type of document which will be sent to the elasticsearch cluster
ttlMs - Time to live expressed in milliseconds. Value <= 0 is ignored
Throws:
Exception

execute

public void execute()
             throws Exception
Description copied from interface: ElasticSearchClient
Sends bulk to the elasticsearch cluster

Specified by:
execute in interface ElasticSearchClient
Throws:
Exception

configure

public void configure(Context context)
Description copied from interface: Configurable

Request the implementing class to (re)configure itself.

When configuration parameters are changed, they must be reflected by the component asap.

There are no thread safety guarrantees on when configure might be called.

Specified by:
configure in interface Configurable


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