Class IndexNameFormatter

java.lang.Object
org.apache.pulsar.io.elasticsearch.IndexNameFormatter

public class IndexNameFormatter extends Object
A class that helps to generate the time-based index names. The formatter finds the pattern %{+<date-format>} in the format string and replace them with strings that are formatted from the event time of the record using <date-format>. The format follows the rules of DateTimeFormatter. For example, suppose the event time of the record is 1645182000000L, the indexName is "logs-%{+yyyy-MM-dd}", then the formatted index name would be "logs-2022-02-18".
  • Constructor Details

    • IndexNameFormatter

      public IndexNameFormatter(String indexNameFormat)
  • Method Details

    • indexName

      public String indexName(org.apache.pulsar.functions.api.Record<org.apache.pulsar.client.api.schema.GenericObject> record)