elasticstack.getElasticsearchIngestProcessorCsv
Explore with Pulumi AI
Helper data source to which can be used to extract fields from CSV line out of a single text field within a document. Any empty field in CSV will be skipped.
See: https://www.elastic.co/guide/en/elasticsearch/reference/current/csv-processor.html
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as elasticstack from "@pulumi/elasticstack";
const csv = elasticstack.getElasticsearchIngestProcessorCsv({
    field: "my_field",
    targetFields: [
        "field1",
        "field2",
    ],
});
const myIngestPipeline = new elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", {processors: [csv.then(csv => csv.json)]});
import pulumi
import pulumi_elasticstack as elasticstack
csv = elasticstack.get_elasticsearch_ingest_processor_csv(field="my_field",
    target_fields=[
        "field1",
        "field2",
    ])
my_ingest_pipeline = elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", processors=[csv.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 {
		csv, err := elasticstack.GetElasticsearchIngestProcessorCsv(ctx, &elasticstack.GetElasticsearchIngestProcessorCsvArgs{
			Field: "my_field",
			TargetFields: []string{
				"field1",
				"field2",
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = elasticstack.NewElasticsearchIngestPipeline(ctx, "myIngestPipeline", &elasticstack.ElasticsearchIngestPipelineArgs{
			Processors: pulumi.StringArray{
				pulumi.String(csv.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 csv = Elasticstack.GetElasticsearchIngestProcessorCsv.Invoke(new()
    {
        Field = "my_field",
        TargetFields = new[]
        {
            "field1",
            "field2",
        },
    });
    var myIngestPipeline = new Elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", new()
    {
        Processors = new[]
        {
            csv.Apply(getElasticsearchIngestProcessorCsvResult => getElasticsearchIngestProcessorCsvResult.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.GetElasticsearchIngestProcessorCsvArgs;
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 csv = ElasticstackFunctions.getElasticsearchIngestProcessorCsv(GetElasticsearchIngestProcessorCsvArgs.builder()
            .field("my_field")
            .targetFields(            
                "field1",
                "field2")
            .build());
        var myIngestPipeline = new ElasticsearchIngestPipeline("myIngestPipeline", ElasticsearchIngestPipelineArgs.builder()
            .processors(csv.applyValue(getElasticsearchIngestProcessorCsvResult -> getElasticsearchIngestProcessorCsvResult.json()))
            .build());
    }
}
resources:
  myIngestPipeline:
    type: elasticstack:ElasticsearchIngestPipeline
    properties:
      processors:
        - ${csv.json}
variables:
  csv:
    fn::invoke:
      function: elasticstack:getElasticsearchIngestProcessorCsv
      arguments:
        field: my_field
        targetFields:
          - field1
          - field2
If the trim option is enabled then any whitespace in the beginning and in the end of each unquoted field will be trimmed. For example with configuration above, a value of A, B will result in field field2 having value {nbsp}B (with space at the beginning). If trim is enabled A, B will result in field field2 having value B (no whitespace). Quoted fields will be left untouched.
Using getElasticsearchIngestProcessorCsv
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 getElasticsearchIngestProcessorCsv(args: GetElasticsearchIngestProcessorCsvArgs, opts?: InvokeOptions): Promise<GetElasticsearchIngestProcessorCsvResult>
function getElasticsearchIngestProcessorCsvOutput(args: GetElasticsearchIngestProcessorCsvOutputArgs, opts?: InvokeOptions): Output<GetElasticsearchIngestProcessorCsvResult>def get_elasticsearch_ingest_processor_csv(description: Optional[str] = None,
                                           empty_value: Optional[str] = None,
                                           field: Optional[str] = None,
                                           if_: Optional[str] = None,
                                           ignore_failure: Optional[bool] = None,
                                           ignore_missing: Optional[bool] = None,
                                           on_failures: Optional[Sequence[str]] = None,
                                           quote: Optional[str] = None,
                                           separator: Optional[str] = None,
                                           tag: Optional[str] = None,
                                           target_fields: Optional[Sequence[str]] = None,
                                           trim: Optional[bool] = None,
                                           opts: Optional[InvokeOptions] = None) -> GetElasticsearchIngestProcessorCsvResult
def get_elasticsearch_ingest_processor_csv_output(description: Optional[pulumi.Input[str]] = None,
                                           empty_value: Optional[pulumi.Input[str]] = None,
                                           field: Optional[pulumi.Input[str]] = None,
                                           if_: Optional[pulumi.Input[str]] = None,
                                           ignore_failure: Optional[pulumi.Input[bool]] = None,
                                           ignore_missing: Optional[pulumi.Input[bool]] = None,
                                           on_failures: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                                           quote: Optional[pulumi.Input[str]] = None,
                                           separator: Optional[pulumi.Input[str]] = None,
                                           tag: Optional[pulumi.Input[str]] = None,
                                           target_fields: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                                           trim: Optional[pulumi.Input[bool]] = None,
                                           opts: Optional[InvokeOptions] = None) -> Output[GetElasticsearchIngestProcessorCsvResult]func GetElasticsearchIngestProcessorCsv(ctx *Context, args *GetElasticsearchIngestProcessorCsvArgs, opts ...InvokeOption) (*GetElasticsearchIngestProcessorCsvResult, error)
func GetElasticsearchIngestProcessorCsvOutput(ctx *Context, args *GetElasticsearchIngestProcessorCsvOutputArgs, opts ...InvokeOption) GetElasticsearchIngestProcessorCsvResultOutput> Note: This function is named GetElasticsearchIngestProcessorCsv in the Go SDK.
public static class GetElasticsearchIngestProcessorCsv 
{
    public static Task<GetElasticsearchIngestProcessorCsvResult> InvokeAsync(GetElasticsearchIngestProcessorCsvArgs args, InvokeOptions? opts = null)
    public static Output<GetElasticsearchIngestProcessorCsvResult> Invoke(GetElasticsearchIngestProcessorCsvInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetElasticsearchIngestProcessorCsvResult> getElasticsearchIngestProcessorCsv(GetElasticsearchIngestProcessorCsvArgs args, InvokeOptions options)
public static Output<GetElasticsearchIngestProcessorCsvResult> getElasticsearchIngestProcessorCsv(GetElasticsearchIngestProcessorCsvArgs args, InvokeOptions options)
fn::invoke:
  function: elasticstack:index/getElasticsearchIngestProcessorCsv:getElasticsearchIngestProcessorCsv
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Field string
 - The field to extract data from.
 - Target
Fields List<string> - The array of fields to assign extracted values to.
 - Description string
 - Description of the processor.
 - Empty
Value string - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - If string
 - Conditionally execute the processor
 - Ignore
Failure bool - Ignore failures for the processor.
 - Ignore
Missing bool - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - On
Failures List<string> - Handle failures for the processor.
 - Quote string
 - Quote used in CSV, has to be single character string
 - Separator string
 - Separator used in CSV, has to be single character string.
 - Tag string
 - Identifier for the processor.
 - Trim bool
 - Trim whitespaces in unquoted fields.
 
- Field string
 - The field to extract data from.
 - Target
Fields []string - The array of fields to assign extracted values to.
 - Description string
 - Description of the processor.
 - Empty
Value string - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - If string
 - Conditionally execute the processor
 - Ignore
Failure bool - Ignore failures for the processor.
 - Ignore
Missing bool - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - On
Failures []string - Handle failures for the processor.
 - Quote string
 - Quote used in CSV, has to be single character string
 - Separator string
 - Separator used in CSV, has to be single character string.
 - Tag string
 - Identifier for the processor.
 - Trim bool
 - Trim whitespaces in unquoted fields.
 
- field String
 - The field to extract data from.
 - target
Fields List<String> - The array of fields to assign extracted values to.
 - description String
 - Description of the processor.
 - empty
Value String - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - if_ String
 - Conditionally execute the processor
 - ignore
Failure Boolean - Ignore failures for the processor.
 - ignore
Missing Boolean - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - on
Failures List<String> - Handle failures for the processor.
 - quote String
 - Quote used in CSV, has to be single character string
 - separator String
 - Separator used in CSV, has to be single character string.
 - tag String
 - Identifier for the processor.
 - trim Boolean
 - Trim whitespaces in unquoted fields.
 
- field string
 - The field to extract data from.
 - target
Fields string[] - The array of fields to assign extracted values to.
 - description string
 - Description of the processor.
 - empty
Value string - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - if string
 - Conditionally execute the processor
 - ignore
Failure boolean - Ignore failures for the processor.
 - ignore
Missing boolean - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - on
Failures string[] - Handle failures for the processor.
 - quote string
 - Quote used in CSV, has to be single character string
 - separator string
 - Separator used in CSV, has to be single character string.
 - tag string
 - Identifier for the processor.
 - trim boolean
 - Trim whitespaces in unquoted fields.
 
- field str
 - The field to extract data from.
 - target_
fields Sequence[str] - The array of fields to assign extracted values to.
 - description str
 - Description of the processor.
 - empty_
value str - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - if_ str
 - Conditionally execute the processor
 - ignore_
failure bool - Ignore failures for the processor.
 - ignore_
missing bool - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - on_
failures Sequence[str] - Handle failures for the processor.
 - quote str
 - Quote used in CSV, has to be single character string
 - separator str
 - Separator used in CSV, has to be single character string.
 - tag str
 - Identifier for the processor.
 - trim bool
 - Trim whitespaces in unquoted fields.
 
- field String
 - The field to extract data from.
 - target
Fields List<String> - The array of fields to assign extracted values to.
 - description String
 - Description of the processor.
 - empty
Value String - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - if String
 - Conditionally execute the processor
 - ignore
Failure Boolean - Ignore failures for the processor.
 - ignore
Missing Boolean - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - on
Failures List<String> - Handle failures for the processor.
 - quote String
 - Quote used in CSV, has to be single character string
 - separator String
 - Separator used in CSV, has to be single character string.
 - tag String
 - Identifier for the processor.
 - trim Boolean
 - Trim whitespaces in unquoted fields.
 
getElasticsearchIngestProcessorCsv Result
The following output properties are available:
- Field string
 - The field to extract data from.
 - Id string
 - Internal identifier of the resource
 - Json string
 - JSON representation of this data source.
 - Target
Fields List<string> - The array of fields to assign extracted values to.
 - Description string
 - Description of the processor.
 - Empty
Value string - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - If string
 - Conditionally execute the processor
 - Ignore
Failure bool - Ignore failures for the processor.
 - Ignore
Missing bool - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - On
Failures List<string> - Handle failures for the processor.
 - Quote string
 - Quote used in CSV, has to be single character string
 - Separator string
 - Separator used in CSV, has to be single character string.
 - Tag string
 - Identifier for the processor.
 - Trim bool
 - Trim whitespaces in unquoted fields.
 
- Field string
 - The field to extract data from.
 - Id string
 - Internal identifier of the resource
 - Json string
 - JSON representation of this data source.
 - Target
Fields []string - The array of fields to assign extracted values to.
 - Description string
 - Description of the processor.
 - Empty
Value string - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - If string
 - Conditionally execute the processor
 - Ignore
Failure bool - Ignore failures for the processor.
 - Ignore
Missing bool - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - On
Failures []string - Handle failures for the processor.
 - Quote string
 - Quote used in CSV, has to be single character string
 - Separator string
 - Separator used in CSV, has to be single character string.
 - Tag string
 - Identifier for the processor.
 - Trim bool
 - Trim whitespaces in unquoted fields.
 
- field String
 - The field to extract data from.
 - id String
 - Internal identifier of the resource
 - json String
 - JSON representation of this data source.
 - target
Fields List<String> - The array of fields to assign extracted values to.
 - description String
 - Description of the processor.
 - empty
Value String - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - if_ String
 - Conditionally execute the processor
 - ignore
Failure Boolean - Ignore failures for the processor.
 - ignore
Missing Boolean - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - on
Failures List<String> - Handle failures for the processor.
 - quote String
 - Quote used in CSV, has to be single character string
 - separator String
 - Separator used in CSV, has to be single character string.
 - tag String
 - Identifier for the processor.
 - trim Boolean
 - Trim whitespaces in unquoted fields.
 
- field string
 - The field to extract data from.
 - id string
 - Internal identifier of the resource
 - json string
 - JSON representation of this data source.
 - target
Fields string[] - The array of fields to assign extracted values to.
 - description string
 - Description of the processor.
 - empty
Value string - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - if string
 - Conditionally execute the processor
 - ignore
Failure boolean - Ignore failures for the processor.
 - ignore
Missing boolean - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - on
Failures string[] - Handle failures for the processor.
 - quote string
 - Quote used in CSV, has to be single character string
 - separator string
 - Separator used in CSV, has to be single character string.
 - tag string
 - Identifier for the processor.
 - trim boolean
 - Trim whitespaces in unquoted fields.
 
- field str
 - The field to extract data from.
 - id str
 - Internal identifier of the resource
 - json str
 - JSON representation of this data source.
 - target_
fields Sequence[str] - The array of fields to assign extracted values to.
 - description str
 - Description of the processor.
 - empty_
value str - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - if_ str
 - Conditionally execute the processor
 - ignore_
failure bool - Ignore failures for the processor.
 - ignore_
missing bool - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - on_
failures Sequence[str] - Handle failures for the processor.
 - quote str
 - Quote used in CSV, has to be single character string
 - separator str
 - Separator used in CSV, has to be single character string.
 - tag str
 - Identifier for the processor.
 - trim bool
 - Trim whitespaces in unquoted fields.
 
- field String
 - The field to extract data from.
 - id String
 - Internal identifier of the resource
 - json String
 - JSON representation of this data source.
 - target
Fields List<String> - The array of fields to assign extracted values to.
 - description String
 - Description of the processor.
 - empty
Value String - Value used to fill empty fields, empty fields will be skipped if this is not provided.
 - if String
 - Conditionally execute the processor
 - ignore
Failure Boolean - Ignore failures for the processor.
 - ignore
Missing Boolean - If 
trueandfielddoes not exist or isnull, the processor quietly exits without modifying the document. - on
Failures List<String> - Handle failures for the processor.
 - quote String
 - Quote used in CSV, has to be single character string
 - separator String
 - Separator used in CSV, has to be single character string.
 - tag String
 - Identifier for the processor.
 - trim Boolean
 - Trim whitespaces in unquoted fields.
 
Package Details
- Repository
 - elasticstack elastic/terraform-provider-elasticstack
 - License
 - Notes
 - This Pulumi package is based on the 
elasticstackTerraform Provider.