org.apache.flume.sink.elasticsearch

## Class TimeBasedIndexNameBuilder

- java.lang.Object
- - org.apache.flume.sink.elasticsearch.TimeBasedIndexNameBuilder

- All Implemented Interfaces:
    Configurable, ConfigurableComponent, IndexNameBuilder

      public class TimeBasedIndexNameBuilder
      extends Object
      implements IndexNameBuilder

  Default index name builder. It prepares name of index using configured prefix and current timestamp. Default format of name is prefix-yyyy-MM-dd".

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DATE_FORMAT`
    `static String` | `DEFAULT_DATE_FORMAT`
    `static String` | `DEFAULT_TIME_ZONE`
    `static String` | `TIME_ZONE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeBasedIndexNameBuilder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `configure(ComponentConfiguration conf)`
    `void` | `configure(Context context)` Request the implementing class to (re)configure itself.
    `String` | `getIndexName(Event event)` Gets the name of the index to use for an index request
    `String` | `getIndexPrefix(Event event)` Gets the prefix of index to use for an index request.

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

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

- - ### Field Detail

    - #### DATE_FORMAT

          public static final String DATE_FORMAT

      See Also:
        Constant Field Values

    - #### TIME_ZONE

          public static final String TIME_ZONE

      See Also:
        Constant Field Values

    - #### DEFAULT_DATE_FORMAT

          public static final String DEFAULT_DATE_FORMAT

      See Also:
        Constant Field Values

    - #### DEFAULT_TIME_ZONE

          public static final String DEFAULT_TIME_ZONE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TimeBasedIndexNameBuilder

          public TimeBasedIndexNameBuilder()

  - ### Method Detail

    - #### getIndexName

          public String getIndexName(Event event)

      Gets the name of the index to use for an index request
      Specified by:
        `getIndexName` in interface `IndexNameBuilder`
      Parameters:
        `event` - Event for which the name of index has to be prepared
      Returns:
        index name of the form 'indexPrefix-formattedTimestamp'

    - #### getIndexPrefix

          public String getIndexPrefix(Event event)

      Description copied from interface: `IndexNameBuilder`
      Gets the prefix of index to use for an index request.
      Specified by:
        `getIndexPrefix` in interface `IndexNameBuilder`
      Parameters:
        `event` - Event which determines index name
      Returns:
        Index prefix name

    - #### 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`

    - #### configure

          public void configure(ComponentConfiguration conf)

      Specified by:
        `configure` in interface `ConfigurableComponent`

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