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

elasticstack.getElasticsearchIngestProcessorDate

Explore with Pulumi AI

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

    Helper data source to which can be used to parse dates from fields, and then uses the date or timestamp as the timestamp for the document. By default, the date processor adds the parsed date as a new field called @timestamp. You can specify a different field by setting the target_field configuration parameter. Multiple date formats are supported as part of the same date processor definition. They will be used sequentially to attempt parsing the date field, in the same order they were defined as part of the processor definition.

    See: https://www.elastic.co/guide/en/elasticsearch/reference/current/date-processor.html

    Example Usage

    Here is an example that adds the parsed date to the timestamp field based on the initial_date field:

    import * as pulumi from "@pulumi/pulumi";
    import * as elasticstack from "@pulumi/elasticstack";
    
    const date = elasticstack.getElasticsearchIngestProcessorDate({
        field: "initial_date",
        targetField: "timestamp",
        formats: ["dd/MM/yyyy HH:mm:ss"],
        timezone: "Europe/Amsterdam",
    });
    const myIngestPipeline = new elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", {processors: [date.then(date => date.json)]});
    
    import pulumi
    import pulumi_elasticstack as elasticstack
    
    date = elasticstack.get_elasticsearch_ingest_processor_date(field="initial_date",
        target_field="timestamp",
        formats=["dd/MM/yyyy HH:mm:ss"],
        timezone="Europe/Amsterdam")
    my_ingest_pipeline = elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", processors=[date.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 {
    		date, err := elasticstack.GetElasticsearchIngestProcessorDate(ctx, &elasticstack.GetElasticsearchIngestProcessorDateArgs{
    			Field:       "initial_date",
    			TargetField: pulumi.StringRef("timestamp"),
    			Formats: []string{
    				"dd/MM/yyyy HH:mm:ss",
    			},
    			Timezone: pulumi.StringRef("Europe/Amsterdam"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = elasticstack.NewElasticsearchIngestPipeline(ctx, "myIngestPipeline", &elasticstack.ElasticsearchIngestPipelineArgs{
    			Processors: pulumi.StringArray{
    				pulumi.String(date.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 date = Elasticstack.GetElasticsearchIngestProcessorDate.Invoke(new()
        {
            Field = "initial_date",
            TargetField = "timestamp",
            Formats = new[]
            {
                "dd/MM/yyyy HH:mm:ss",
            },
            Timezone = "Europe/Amsterdam",
        });
    
        var myIngestPipeline = new Elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", new()
        {
            Processors = new[]
            {
                date.Apply(getElasticsearchIngestProcessorDateResult => getElasticsearchIngestProcessorDateResult.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.GetElasticsearchIngestProcessorDateArgs;
    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 date = ElasticstackFunctions.getElasticsearchIngestProcessorDate(GetElasticsearchIngestProcessorDateArgs.builder()
                .field("initial_date")
                .targetField("timestamp")
                .formats("dd/MM/yyyy HH:mm:ss")
                .timezone("Europe/Amsterdam")
                .build());
    
            var myIngestPipeline = new ElasticsearchIngestPipeline("myIngestPipeline", ElasticsearchIngestPipelineArgs.builder()
                .processors(date.applyValue(getElasticsearchIngestProcessorDateResult -> getElasticsearchIngestProcessorDateResult.json()))
                .build());
    
        }
    }
    
    resources:
      myIngestPipeline:
        type: elasticstack:ElasticsearchIngestPipeline
        properties:
          processors:
            - ${date.json}
    variables:
      date:
        fn::invoke:
          function: elasticstack:getElasticsearchIngestProcessorDate
          arguments:
            field: initial_date
            targetField: timestamp
            formats:
              - dd/MM/yyyy HH:mm:ss
            timezone: Europe/Amsterdam
    

    Using getElasticsearchIngestProcessorDate

    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 getElasticsearchIngestProcessorDate(args: GetElasticsearchIngestProcessorDateArgs, opts?: InvokeOptions): Promise<GetElasticsearchIngestProcessorDateResult>
    function getElasticsearchIngestProcessorDateOutput(args: GetElasticsearchIngestProcessorDateOutputArgs, opts?: InvokeOptions): Output<GetElasticsearchIngestProcessorDateResult>
    def get_elasticsearch_ingest_processor_date(description: Optional[str] = None,
                                                field: Optional[str] = None,
                                                formats: Optional[Sequence[str]] = None,
                                                if_: Optional[str] = None,
                                                ignore_failure: Optional[bool] = None,
                                                locale: Optional[str] = None,
                                                on_failures: Optional[Sequence[str]] = None,
                                                output_format: Optional[str] = None,
                                                tag: Optional[str] = None,
                                                target_field: Optional[str] = None,
                                                timezone: Optional[str] = None,
                                                opts: Optional[InvokeOptions] = None) -> GetElasticsearchIngestProcessorDateResult
    def get_elasticsearch_ingest_processor_date_output(description: Optional[pulumi.Input[str]] = None,
                                                field: Optional[pulumi.Input[str]] = None,
                                                formats: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                                                if_: Optional[pulumi.Input[str]] = None,
                                                ignore_failure: Optional[pulumi.Input[bool]] = None,
                                                locale: Optional[pulumi.Input[str]] = None,
                                                on_failures: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                                                output_format: Optional[pulumi.Input[str]] = None,
                                                tag: Optional[pulumi.Input[str]] = None,
                                                target_field: Optional[pulumi.Input[str]] = None,
                                                timezone: Optional[pulumi.Input[str]] = None,
                                                opts: Optional[InvokeOptions] = None) -> Output[GetElasticsearchIngestProcessorDateResult]
    func GetElasticsearchIngestProcessorDate(ctx *Context, args *GetElasticsearchIngestProcessorDateArgs, opts ...InvokeOption) (*GetElasticsearchIngestProcessorDateResult, error)
    func GetElasticsearchIngestProcessorDateOutput(ctx *Context, args *GetElasticsearchIngestProcessorDateOutputArgs, opts ...InvokeOption) GetElasticsearchIngestProcessorDateResultOutput

    > Note: This function is named GetElasticsearchIngestProcessorDate in the Go SDK.

    public static class GetElasticsearchIngestProcessorDate 
    {
        public static Task<GetElasticsearchIngestProcessorDateResult> InvokeAsync(GetElasticsearchIngestProcessorDateArgs args, InvokeOptions? opts = null)
        public static Output<GetElasticsearchIngestProcessorDateResult> Invoke(GetElasticsearchIngestProcessorDateInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetElasticsearchIngestProcessorDateResult> getElasticsearchIngestProcessorDate(GetElasticsearchIngestProcessorDateArgs args, InvokeOptions options)
    public static Output<GetElasticsearchIngestProcessorDateResult> getElasticsearchIngestProcessorDate(GetElasticsearchIngestProcessorDateArgs args, InvokeOptions options)
    
    fn::invoke:
      function: elasticstack:index/getElasticsearchIngestProcessorDate:getElasticsearchIngestProcessorDate
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Field string
    The field to get the date from.
    Formats List<string>
    An array of the expected date formats.
    Description string
    Description of the processor.
    If string
    Conditionally execute the processor
    IgnoreFailure bool
    Ignore failures for the processor.
    Locale string
    The locale to use when parsing the date, relevant when parsing month names or week days.
    OnFailures List<string>
    Handle failures for the processor.
    OutputFormat string
    The format to use when writing the date to target_field.
    Tag string
    Identifier for the processor.
    TargetField string
    The field that will hold the parsed date.
    Timezone string
    The timezone to use when parsing the date.
    Field string
    The field to get the date from.
    Formats []string
    An array of the expected date formats.
    Description string
    Description of the processor.
    If string
    Conditionally execute the processor
    IgnoreFailure bool
    Ignore failures for the processor.
    Locale string
    The locale to use when parsing the date, relevant when parsing month names or week days.
    OnFailures []string
    Handle failures for the processor.
    OutputFormat string
    The format to use when writing the date to target_field.
    Tag string
    Identifier for the processor.
    TargetField string
    The field that will hold the parsed date.
    Timezone string
    The timezone to use when parsing the date.
    field String
    The field to get the date from.
    formats List<String>
    An array of the expected date formats.
    description String
    Description of the processor.
    if_ String
    Conditionally execute the processor
    ignoreFailure Boolean
    Ignore failures for the processor.
    locale String
    The locale to use when parsing the date, relevant when parsing month names or week days.
    onFailures List<String>
    Handle failures for the processor.
    outputFormat String
    The format to use when writing the date to target_field.
    tag String
    Identifier for the processor.
    targetField String
    The field that will hold the parsed date.
    timezone String
    The timezone to use when parsing the date.
    field string
    The field to get the date from.
    formats string[]
    An array of the expected date formats.
    description string
    Description of the processor.
    if string
    Conditionally execute the processor
    ignoreFailure boolean
    Ignore failures for the processor.
    locale string
    The locale to use when parsing the date, relevant when parsing month names or week days.
    onFailures string[]
    Handle failures for the processor.
    outputFormat string
    The format to use when writing the date to target_field.
    tag string
    Identifier for the processor.
    targetField string
    The field that will hold the parsed date.
    timezone string
    The timezone to use when parsing the date.
    field str
    The field to get the date from.
    formats Sequence[str]
    An array of the expected date formats.
    description str
    Description of the processor.
    if_ str
    Conditionally execute the processor
    ignore_failure bool
    Ignore failures for the processor.
    locale str
    The locale to use when parsing the date, relevant when parsing month names or week days.
    on_failures Sequence[str]
    Handle failures for the processor.
    output_format str
    The format to use when writing the date to target_field.
    tag str
    Identifier for the processor.
    target_field str
    The field that will hold the parsed date.
    timezone str
    The timezone to use when parsing the date.
    field String
    The field to get the date from.
    formats List<String>
    An array of the expected date formats.
    description String
    Description of the processor.
    if String
    Conditionally execute the processor
    ignoreFailure Boolean
    Ignore failures for the processor.
    locale String
    The locale to use when parsing the date, relevant when parsing month names or week days.
    onFailures List<String>
    Handle failures for the processor.
    outputFormat String
    The format to use when writing the date to target_field.
    tag String
    Identifier for the processor.
    targetField String
    The field that will hold the parsed date.
    timezone String
    The timezone to use when parsing the date.

    getElasticsearchIngestProcessorDate Result

    The following output properties are available:

    Field string
    The field to get the date from.
    Formats List<string>
    An array of the expected date formats.
    Id string
    Internal identifier of the resource
    Json string
    JSON representation of this data source.
    Description string
    Description of the processor.
    If string
    Conditionally execute the processor
    IgnoreFailure bool
    Ignore failures for the processor.
    Locale string
    The locale to use when parsing the date, relevant when parsing month names or week days.
    OnFailures List<string>
    Handle failures for the processor.
    OutputFormat string
    The format to use when writing the date to target_field.
    Tag string
    Identifier for the processor.
    TargetField string
    The field that will hold the parsed date.
    Timezone string
    The timezone to use when parsing the date.
    Field string
    The field to get the date from.
    Formats []string
    An array of the expected date formats.
    Id string
    Internal identifier of the resource
    Json string
    JSON representation of this data source.
    Description string
    Description of the processor.
    If string
    Conditionally execute the processor
    IgnoreFailure bool
    Ignore failures for the processor.
    Locale string
    The locale to use when parsing the date, relevant when parsing month names or week days.
    OnFailures []string
    Handle failures for the processor.
    OutputFormat string
    The format to use when writing the date to target_field.
    Tag string
    Identifier for the processor.
    TargetField string
    The field that will hold the parsed date.
    Timezone string
    The timezone to use when parsing the date.
    field String
    The field to get the date from.
    formats List<String>
    An array of the expected date formats.
    id String
    Internal identifier of the resource
    json String
    JSON representation of this data source.
    description String
    Description of the processor.
    if_ String
    Conditionally execute the processor
    ignoreFailure Boolean
    Ignore failures for the processor.
    locale String
    The locale to use when parsing the date, relevant when parsing month names or week days.
    onFailures List<String>
    Handle failures for the processor.
    outputFormat String
    The format to use when writing the date to target_field.
    tag String
    Identifier for the processor.
    targetField String
    The field that will hold the parsed date.
    timezone String
    The timezone to use when parsing the date.
    field string
    The field to get the date from.
    formats string[]
    An array of the expected date formats.
    id string
    Internal identifier of the resource
    json string
    JSON representation of this data source.
    description string
    Description of the processor.
    if string
    Conditionally execute the processor
    ignoreFailure boolean
    Ignore failures for the processor.
    locale string
    The locale to use when parsing the date, relevant when parsing month names or week days.
    onFailures string[]
    Handle failures for the processor.
    outputFormat string
    The format to use when writing the date to target_field.
    tag string
    Identifier for the processor.
    targetField string
    The field that will hold the parsed date.
    timezone string
    The timezone to use when parsing the date.
    field str
    The field to get the date from.
    formats Sequence[str]
    An array of the expected date formats.
    id str
    Internal identifier of the resource
    json str
    JSON representation of this data source.
    description str
    Description of the processor.
    if_ str
    Conditionally execute the processor
    ignore_failure bool
    Ignore failures for the processor.
    locale str
    The locale to use when parsing the date, relevant when parsing month names or week days.
    on_failures Sequence[str]
    Handle failures for the processor.
    output_format str
    The format to use when writing the date to target_field.
    tag str
    Identifier for the processor.
    target_field str
    The field that will hold the parsed date.
    timezone str
    The timezone to use when parsing the date.
    field String
    The field to get the date from.
    formats List<String>
    An array of the expected date formats.
    id String
    Internal identifier of the resource
    json String
    JSON representation of this data source.
    description String
    Description of the processor.
    if String
    Conditionally execute the processor
    ignoreFailure Boolean
    Ignore failures for the processor.
    locale String
    The locale to use when parsing the date, relevant when parsing month names or week days.
    onFailures List<String>
    Handle failures for the processor.
    outputFormat String
    The format to use when writing the date to target_field.
    tag String
    Identifier for the processor.
    targetField String
    The field that will hold the parsed date.
    timezone String
    The timezone to use when parsing the date.

    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