1. Packages
  2. Elasticstack Provider
  3. API Docs
  4. getElasticsearchIngestProcessorDateIndexName
elasticstack 0.11.15 published on Wednesday, Apr 23, 2025 by elastic

elasticstack.getElasticsearchIngestProcessorDateIndexName

Explore with Pulumi AI

elasticstack logo
elasticstack 0.11.15 published on Wednesday, Apr 23, 2025 by elastic

    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 dictionary

    The following arguments are supported:

    DateRounding 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.
    DateFormats 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
    IgnoreFailure bool
    Ignore failures for the processor.
    IndexNameFormat string
    The format to be used when printing the parsed date into the index name.
    IndexNamePrefix string
    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.
    OnFailures 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.
    DateRounding 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.
    DateFormats []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
    IgnoreFailure bool
    Ignore failures for the processor.
    IndexNameFormat string
    The format to be used when printing the parsed date into the index name.
    IndexNamePrefix string
    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.
    OnFailures []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.
    dateRounding 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.
    dateFormats 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
    ignoreFailure Boolean
    Ignore failures for the processor.
    indexNameFormat String
    The format to be used when printing the parsed date into the index name.
    indexNamePrefix String
    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.
    onFailures 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.
    dateRounding 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.
    dateFormats 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
    ignoreFailure boolean
    Ignore failures for the processor.
    indexNameFormat string
    The format to be used when printing the parsed date into the index name.
    indexNamePrefix string
    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.
    onFailures 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_format str
    The format to be used when printing the parsed date into the index name.
    index_name_prefix str
    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.
    dateRounding 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.
    dateFormats 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
    ignoreFailure Boolean
    Ignore failures for the processor.
    indexNameFormat String
    The format to be used when printing the parsed date into the index name.
    indexNamePrefix String
    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.
    onFailures 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:

    DateRounding 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.
    DateFormats 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
    IgnoreFailure bool
    Ignore failures for the processor.
    IndexNameFormat string
    The format to be used when printing the parsed date into the index name.
    IndexNamePrefix string
    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.
    OnFailures 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.
    DateRounding 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.
    DateFormats []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
    IgnoreFailure bool
    Ignore failures for the processor.
    IndexNameFormat string
    The format to be used when printing the parsed date into the index name.
    IndexNamePrefix string
    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.
    OnFailures []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.
    dateRounding 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.
    dateFormats 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
    ignoreFailure Boolean
    Ignore failures for the processor.
    indexNameFormat String
    The format to be used when printing the parsed date into the index name.
    indexNamePrefix String
    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.
    onFailures 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.
    dateRounding 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.
    dateFormats 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
    ignoreFailure boolean
    Ignore failures for the processor.
    indexNameFormat string
    The format to be used when printing the parsed date into the index name.
    indexNamePrefix string
    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.
    onFailures 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_format str
    The format to be used when printing the parsed date into the index name.
    index_name_prefix str
    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.
    dateRounding 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.
    dateFormats 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
    ignoreFailure Boolean
    Ignore failures for the processor.
    indexNameFormat String
    The format to be used when printing the parsed date into the index name.
    indexNamePrefix String
    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.
    onFailures 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 elasticstack Terraform Provider.
    elasticstack logo
    elasticstack 0.11.15 published on Wednesday, Apr 23, 2025 by elastic