org.apache.flume.sink.elasticsearch

## Class EventSerializerIndexRequestBuilderFactory

- java.lang.Object
- - org.apache.flume.sink.elasticsearch.AbstractElasticSearchIndexRequestBuilderFactory
  - - org.apache.flume.sink.elasticsearch.EventSerializerIndexRequestBuilderFactory

- All Implemented Interfaces:
    Configurable, ConfigurableComponent, ElasticSearchIndexRequestBuilderFactory

      public class EventSerializerIndexRequestBuilderFactory
      extends AbstractElasticSearchIndexRequestBuilderFactory

  Default implementation of `ElasticSearchIndexRequestBuilderFactory`. It serializes flume events using the `ElasticSearchEventSerializer` instance configured on the sink.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ElasticSearchEventSerializer` | `serializer`

    - ### Fields inherited from class org.apache.flume.sink.elasticsearch.AbstractElasticSearchIndexRequestBuilderFactory

      `fastDateFormat`

    - ### Fields inherited from interface org.apache.flume.sink.elasticsearch.ElasticSearchIndexRequestBuilderFactory

      `df`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `EventSerializerIndexRequestBuilderFactory(ElasticSearchEventSerializer serializer)`
    `protected` | `EventSerializerIndexRequestBuilderFactory(ElasticSearchEventSerializer serializer, org.apache.commons.lang.time.FastDateFormat fdf)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `configure(ComponentConfiguration config)`
    `void` | `configure(Context context)` Request the implementing class to (re)configure itself.
    `protected void` | `prepareIndexRequest(org.elasticsearch.action.index.IndexRequestBuilder indexRequest, String indexName, String indexType, Event event)` Prepares an ElasticSearch `IndexRequestBuilder` instance

    - ### Methods inherited from class org.apache.flume.sink.elasticsearch.AbstractElasticSearchIndexRequestBuilderFactory

      `createIndexRequest, getIndexName`

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

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

- - ### Field Detail

    - #### serializer

          protected final ElasticSearchEventSerializer serializer

  - ### Constructor Detail

    - #### EventSerializerIndexRequestBuilderFactory

          public EventSerializerIndexRequestBuilderFactory(ElasticSearchEventSerializer serializer)

    - #### EventSerializerIndexRequestBuilderFactory

          protected EventSerializerIndexRequestBuilderFactory(ElasticSearchEventSerializer serializer,
                                                   org.apache.commons.lang.time.FastDateFormat fdf)

  - ### Method Detail

    - #### 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 guarantees on when configure might be called.

      Specified by:
        `configure` in interface `Configurable`
      Specified by:
        `configure` in class `AbstractElasticSearchIndexRequestBuilderFactory`
      See Also:
        `Configurable`

    - #### configure

          public void configure(ComponentConfiguration config)

      Specified by:
        `configure` in interface `ConfigurableComponent`
      Specified by:
        `configure` in class `AbstractElasticSearchIndexRequestBuilderFactory`
      See Also:
        `ConfigurableComponent`

    - #### prepareIndexRequest

          protected void prepareIndexRequest(org.elasticsearch.action.index.IndexRequestBuilder indexRequest,
                                 String indexName,
                                 String indexType,
                                 Event event)
                                      throws IOException

      Description copied from class: `AbstractElasticSearchIndexRequestBuilderFactory`
      Prepares an ElasticSearch `IndexRequestBuilder` instance
      Specified by:
        `prepareIndexRequest` in class `AbstractElasticSearchIndexRequestBuilderFactory`
      Parameters:
        `indexRequest` - The (empty) ElasticSearch `IndexRequestBuilder` to prepare
        `indexName` - Index name to use -- as per `AbstractElasticSearchIndexRequestBuilderFactory.getIndexName(String, long)`
        `indexType` - Index type to use -- as configured on the sink
        `event` - Flume event to serialize and add to index request
      Throws:
        `IOException` - If an error occurs e.g. during serialization

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