elasticstack.getElasticsearchIngestProcessorDateIndexName
Explore with Pulumi AI
The purpose of this processor is to point documents to the right time based index based on a date or timestamp field in a document by using the date math index name support.
The processor sets the _index metadata field with a date math index name expression based on the provided index name prefix, a date or timestamp field in the documents being processed and the provided date rounding.
First, this processor fetches the date or timestamp from a field in the document being processed. Optionally, date formatting can be configured on how the field’s value should be parsed into a date. Then this date, the provided index name prefix and the provided date rounding get formatted into a date math index name expression. Also here optionally date formatting can be specified on how the date should be formatted into a date math index name expression.
See: https://www.elastic.co/guide/en/elasticsearch/reference/current/date-index-name-processor.html
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as elasticstack from "@pulumi/elasticstack";
const dateIndexName = elasticstack.getElasticsearchIngestProcessorDateIndexName({
    description: "monthly date-time index naming",
    field: "date1",
    indexNamePrefix: "my-index-",
    dateRounding: "M",
});
const myIngestPipeline = new elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", {processors: [dateIndexName.then(dateIndexName => dateIndexName.json)]});
import pulumi
import pulumi_elasticstack as elasticstack
date_index_name = elasticstack.get_elasticsearch_ingest_processor_date_index_name(description="monthly date-time index naming",
    field="date1",
    index_name_prefix="my-index-",
    date_rounding="M")
my_ingest_pipeline = elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", processors=[date_index_name.json])
package main
import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/elasticstack/elasticstack"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		dateIndexName, err := elasticstack.GetElasticsearchIngestProcessorDateIndexName(ctx, &elasticstack.GetElasticsearchIngestProcessorDateIndexNameArgs{
			Description:     pulumi.StringRef("monthly date-time index naming"),
			Field:           "date1",
			IndexNamePrefix: pulumi.StringRef("my-index-"),
			DateRounding:    "M",
		}, nil)
		if err != nil {
			return err
		}
		_, err = elasticstack.NewElasticsearchIngestPipeline(ctx, "myIngestPipeline", &elasticstack.ElasticsearchIngestPipelineArgs{
			Processors: pulumi.StringArray{
				pulumi.String(dateIndexName.Json),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Elasticstack = Pulumi.Elasticstack;
return await Deployment.RunAsync(() => 
{
    var dateIndexName = Elasticstack.GetElasticsearchIngestProcessorDateIndexName.Invoke(new()
    {
        Description = "monthly date-time index naming",
        Field = "date1",
        IndexNamePrefix = "my-index-",
        DateRounding = "M",
    });
    var myIngestPipeline = new Elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", new()
    {
        Processors = new[]
        {
            dateIndexName.Apply(getElasticsearchIngestProcessorDateIndexNameResult => getElasticsearchIngestProcessorDateIndexNameResult.Json),
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.elasticstack.ElasticstackFunctions;
import com.pulumi.elasticstack.inputs.GetElasticsearchIngestProcessorDateIndexNameArgs;
import com.pulumi.elasticstack.ElasticsearchIngestPipeline;
import com.pulumi.elasticstack.ElasticsearchIngestPipelineArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var dateIndexName = ElasticstackFunctions.getElasticsearchIngestProcessorDateIndexName(GetElasticsearchIngestProcessorDateIndexNameArgs.builder()
            .description("monthly date-time index naming")
            .field("date1")
            .indexNamePrefix("my-index-")
            .dateRounding("M")
            .build());
        var myIngestPipeline = new ElasticsearchIngestPipeline("myIngestPipeline", ElasticsearchIngestPipelineArgs.builder()
            .processors(dateIndexName.applyValue(getElasticsearchIngestProcessorDateIndexNameResult -> getElasticsearchIngestProcessorDateIndexNameResult.json()))
            .build());
    }
}
resources:
  myIngestPipeline:
    type: elasticstack:ElasticsearchIngestPipeline
    properties:
      processors:
        - ${dateIndexName.json}
variables:
  dateIndexName:
    fn::invoke:
      function: elasticstack:getElasticsearchIngestProcessorDateIndexName
      arguments:
        description: monthly date-time index naming
        field: date1
        indexNamePrefix: my-index-
        dateRounding: M
Using getElasticsearchIngestProcessorDateIndexName
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getElasticsearchIngestProcessorDateIndexName(args: GetElasticsearchIngestProcessorDateIndexNameArgs, opts?: InvokeOptions): Promise<GetElasticsearchIngestProcessorDateIndexNameResult>
function getElasticsearchIngestProcessorDateIndexNameOutput(args: GetElasticsearchIngestProcessorDateIndexNameOutputArgs, opts?: InvokeOptions): Output<GetElasticsearchIngestProcessorDateIndexNameResult>def get_elasticsearch_ingest_processor_date_index_name(date_formats: Optional[Sequence[str]] = None,
                                                       date_rounding: Optional[str] = None,
                                                       description: Optional[str] = None,
                                                       field: Optional[str] = None,
                                                       if_: Optional[str] = None,
                                                       ignore_failure: Optional[bool] = None,
                                                       index_name_format: Optional[str] = None,
                                                       index_name_prefix: Optional[str] = None,
                                                       locale: Optional[str] = None,
                                                       on_failures: Optional[Sequence[str]] = None,
                                                       tag: Optional[str] = None,
                                                       timezone: Optional[str] = None,
                                                       opts: Optional[InvokeOptions] = None) -> GetElasticsearchIngestProcessorDateIndexNameResult
def get_elasticsearch_ingest_processor_date_index_name_output(date_formats: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                                                       date_rounding: Optional[pulumi.Input[str]] = None,
                                                       description: Optional[pulumi.Input[str]] = None,
                                                       field: Optional[pulumi.Input[str]] = None,
                                                       if_: Optional[pulumi.Input[str]] = None,
                                                       ignore_failure: Optional[pulumi.Input[bool]] = None,
                                                       index_name_format: Optional[pulumi.Input[str]] = None,
                                                       index_name_prefix: Optional[pulumi.Input[str]] = None,
                                                       locale: Optional[pulumi.Input[str]] = None,
                                                       on_failures: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                                                       tag: Optional[pulumi.Input[str]] = None,
                                                       timezone: Optional[pulumi.Input[str]] = None,
                                                       opts: Optional[InvokeOptions] = None) -> Output[GetElasticsearchIngestProcessorDateIndexNameResult]func GetElasticsearchIngestProcessorDateIndexName(ctx *Context, args *GetElasticsearchIngestProcessorDateIndexNameArgs, opts ...InvokeOption) (*GetElasticsearchIngestProcessorDateIndexNameResult, error)
func GetElasticsearchIngestProcessorDateIndexNameOutput(ctx *Context, args *GetElasticsearchIngestProcessorDateIndexNameOutputArgs, opts ...InvokeOption) GetElasticsearchIngestProcessorDateIndexNameResultOutput> Note: This function is named GetElasticsearchIngestProcessorDateIndexName in the Go SDK.
public static class GetElasticsearchIngestProcessorDateIndexName 
{
    public static Task<GetElasticsearchIngestProcessorDateIndexNameResult> InvokeAsync(GetElasticsearchIngestProcessorDateIndexNameArgs args, InvokeOptions? opts = null)
    public static Output<GetElasticsearchIngestProcessorDateIndexNameResult> Invoke(GetElasticsearchIngestProcessorDateIndexNameInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetElasticsearchIngestProcessorDateIndexNameResult> getElasticsearchIngestProcessorDateIndexName(GetElasticsearchIngestProcessorDateIndexNameArgs args, InvokeOptions options)
public static Output<GetElasticsearchIngestProcessorDateIndexNameResult> getElasticsearchIngestProcessorDateIndexName(GetElasticsearchIngestProcessorDateIndexNameArgs args, InvokeOptions options)
fn::invoke:
  function: elasticstack:index/getElasticsearchIngestProcessorDateIndexName:getElasticsearchIngestProcessorDateIndexName
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Date
Rounding string - How to round the date when formatting the date into the index name.
 - Field string
 - The field to get the date or timestamp from.
 - Date
Formats List<string> - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - Description string
 - Description of the processor.
 - If string
 - Conditionally execute the processor
 - Ignore
Failure bool - Ignore failures for the processor.
 - Index
Name stringFormat  - The format to be used when printing the parsed date into the index name.
 - Index
Name stringPrefix  - A prefix of the index name to be prepended before the printed date.
 - Locale string
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - On
Failures List<string> - Handle failures for the processor.
 - Tag string
 - Identifier for the processor.
 - Timezone string
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
- Date
Rounding string - How to round the date when formatting the date into the index name.
 - Field string
 - The field to get the date or timestamp from.
 - Date
Formats []string - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - Description string
 - Description of the processor.
 - If string
 - Conditionally execute the processor
 - Ignore
Failure bool - Ignore failures for the processor.
 - Index
Name stringFormat  - The format to be used when printing the parsed date into the index name.
 - Index
Name stringPrefix  - A prefix of the index name to be prepended before the printed date.
 - Locale string
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - On
Failures []string - Handle failures for the processor.
 - Tag string
 - Identifier for the processor.
 - Timezone string
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
- date
Rounding String - How to round the date when formatting the date into the index name.
 - field String
 - The field to get the date or timestamp from.
 - date
Formats List<String> - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - description String
 - Description of the processor.
 - if_ String
 - Conditionally execute the processor
 - ignore
Failure Boolean - Ignore failures for the processor.
 - index
Name StringFormat  - The format to be used when printing the parsed date into the index name.
 - index
Name StringPrefix  - A prefix of the index name to be prepended before the printed date.
 - locale String
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - on
Failures List<String> - Handle failures for the processor.
 - tag String
 - Identifier for the processor.
 - timezone String
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
- date
Rounding string - How to round the date when formatting the date into the index name.
 - field string
 - The field to get the date or timestamp from.
 - date
Formats string[] - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - description string
 - Description of the processor.
 - if string
 - Conditionally execute the processor
 - ignore
Failure boolean - Ignore failures for the processor.
 - index
Name stringFormat  - The format to be used when printing the parsed date into the index name.
 - index
Name stringPrefix  - A prefix of the index name to be prepended before the printed date.
 - locale string
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - on
Failures string[] - Handle failures for the processor.
 - tag string
 - Identifier for the processor.
 - timezone string
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
- date_
rounding str - How to round the date when formatting the date into the index name.
 - field str
 - The field to get the date or timestamp from.
 - date_
formats Sequence[str] - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - description str
 - Description of the processor.
 - if_ str
 - Conditionally execute the processor
 - ignore_
failure bool - Ignore failures for the processor.
 - index_
name_ strformat  - The format to be used when printing the parsed date into the index name.
 - index_
name_ strprefix  - A prefix of the index name to be prepended before the printed date.
 - locale str
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - on_
failures Sequence[str] - Handle failures for the processor.
 - tag str
 - Identifier for the processor.
 - timezone str
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
- date
Rounding String - How to round the date when formatting the date into the index name.
 - field String
 - The field to get the date or timestamp from.
 - date
Formats List<String> - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - description String
 - Description of the processor.
 - if String
 - Conditionally execute the processor
 - ignore
Failure Boolean - Ignore failures for the processor.
 - index
Name StringFormat  - The format to be used when printing the parsed date into the index name.
 - index
Name StringPrefix  - A prefix of the index name to be prepended before the printed date.
 - locale String
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - on
Failures List<String> - Handle failures for the processor.
 - tag String
 - Identifier for the processor.
 - timezone String
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
getElasticsearchIngestProcessorDateIndexName Result
The following output properties are available:
- Date
Rounding string - How to round the date when formatting the date into the index name.
 - Field string
 - The field to get the date or timestamp from.
 - Id string
 - Internal identifier of the resource
 - Json string
 - JSON representation of this data source.
 - Date
Formats List<string> - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - Description string
 - Description of the processor.
 - If string
 - Conditionally execute the processor
 - Ignore
Failure bool - Ignore failures for the processor.
 - Index
Name stringFormat  - The format to be used when printing the parsed date into the index name.
 - Index
Name stringPrefix  - A prefix of the index name to be prepended before the printed date.
 - Locale string
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - On
Failures List<string> - Handle failures for the processor.
 - Tag string
 - Identifier for the processor.
 - Timezone string
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
- Date
Rounding string - How to round the date when formatting the date into the index name.
 - Field string
 - The field to get the date or timestamp from.
 - Id string
 - Internal identifier of the resource
 - Json string
 - JSON representation of this data source.
 - Date
Formats []string - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - Description string
 - Description of the processor.
 - If string
 - Conditionally execute the processor
 - Ignore
Failure bool - Ignore failures for the processor.
 - Index
Name stringFormat  - The format to be used when printing the parsed date into the index name.
 - Index
Name stringPrefix  - A prefix of the index name to be prepended before the printed date.
 - Locale string
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - On
Failures []string - Handle failures for the processor.
 - Tag string
 - Identifier for the processor.
 - Timezone string
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
- date
Rounding String - How to round the date when formatting the date into the index name.
 - field String
 - The field to get the date or timestamp from.
 - id String
 - Internal identifier of the resource
 - json String
 - JSON representation of this data source.
 - date
Formats List<String> - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - description String
 - Description of the processor.
 - if_ String
 - Conditionally execute the processor
 - ignore
Failure Boolean - Ignore failures for the processor.
 - index
Name StringFormat  - The format to be used when printing the parsed date into the index name.
 - index
Name StringPrefix  - A prefix of the index name to be prepended before the printed date.
 - locale String
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - on
Failures List<String> - Handle failures for the processor.
 - tag String
 - Identifier for the processor.
 - timezone String
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
- date
Rounding string - How to round the date when formatting the date into the index name.
 - field string
 - The field to get the date or timestamp from.
 - id string
 - Internal identifier of the resource
 - json string
 - JSON representation of this data source.
 - date
Formats string[] - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - description string
 - Description of the processor.
 - if string
 - Conditionally execute the processor
 - ignore
Failure boolean - Ignore failures for the processor.
 - index
Name stringFormat  - The format to be used when printing the parsed date into the index name.
 - index
Name stringPrefix  - A prefix of the index name to be prepended before the printed date.
 - locale string
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - on
Failures string[] - Handle failures for the processor.
 - tag string
 - Identifier for the processor.
 - timezone string
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
- date_
rounding str - How to round the date when formatting the date into the index name.
 - field str
 - The field to get the date or timestamp from.
 - id str
 - Internal identifier of the resource
 - json str
 - JSON representation of this data source.
 - date_
formats Sequence[str] - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - description str
 - Description of the processor.
 - if_ str
 - Conditionally execute the processor
 - ignore_
failure bool - Ignore failures for the processor.
 - index_
name_ strformat  - The format to be used when printing the parsed date into the index name.
 - index_
name_ strprefix  - A prefix of the index name to be prepended before the printed date.
 - locale str
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - on_
failures Sequence[str] - Handle failures for the processor.
 - tag str
 - Identifier for the processor.
 - timezone str
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
- date
Rounding String - How to round the date when formatting the date into the index name.
 - field String
 - The field to get the date or timestamp from.
 - id String
 - Internal identifier of the resource
 - json String
 - JSON representation of this data source.
 - date
Formats List<String> - An array of the expected date formats for parsing dates / timestamps in the document being preprocessed.
 - description String
 - Description of the processor.
 - if String
 - Conditionally execute the processor
 - ignore
Failure Boolean - Ignore failures for the processor.
 - index
Name StringFormat  - The format to be used when printing the parsed date into the index name.
 - index
Name StringPrefix  - A prefix of the index name to be prepended before the printed date.
 - locale String
 - The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
 - on
Failures List<String> - Handle failures for the processor.
 - tag String
 - Identifier for the processor.
 - timezone String
 - The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
 
Package Details
- Repository
 - elasticstack elastic/terraform-provider-elasticstack
 - License
 - Notes
 - This Pulumi package is based on the 
elasticstackTerraform Provider.