// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** import * as pulumi from "@pulumi/pulumi"; import * as utilities from "./utilities"; /** * Helper data source to which can be used to convert a field in the currently ingested document to a different type, such as converting a string to an integer. If the field value is an array, all members will be converted. * * The supported types include: `integer`, `long`, `float`, `double`, `string`, `boolean`, `ip`, and `auto`. * * Specifying `boolean` will set the field to true if its string value is equal to true (ignore case), to false if its string value is equal to false (ignore case), or it will throw an exception otherwise. * * Specifying `ip` will set the target field to the value of `field` if it contains a valid IPv4 or IPv6 address that can be indexed into an IP field type. * * Specifying `auto` will attempt to convert the string-valued `field` into the closest non-string, non-IP type. For example, a field whose value is "true" will be converted to its respective boolean type: true. Do note that float takes precedence of double in auto. A value of "242.15" will "automatically" be converted to 242.15 of type `float`. If a provided field cannot be appropriately converted, the processor will still process successfully and leave the field value as-is. In such a case, `targetField` will be updated with the unconverted field value. * * See: https://www.elastic.co/guide/en/elasticsearch/reference/current/convert-processor.html * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as elasticstack from "@pulumi/elasticstack"; * * const convert = elasticstack.ElasticsearchIngestProcessorConvert({ * description: "converts the content of the id field to an integer", * field: "id", * type: "integer", * }); * const myIngestPipeline = new elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", {processors: [convert.then(convert => convert.json)]}); * ``` */ export function elasticsearchIngestProcessorConvert(args: ElasticsearchIngestProcessorConvertArgs, opts?: pulumi.InvokeOptions): Promise { if (!opts) { opts = {} } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); return pulumi.runtime.invoke("elasticstack:index/elasticsearchIngestProcessorConvert:ElasticsearchIngestProcessorConvert", { "description": args.description, "field": args.field, "if": args.if, "ignoreFailure": args.ignoreFailure, "ignoreMissing": args.ignoreMissing, "onFailures": args.onFailures, "tag": args.tag, "targetField": args.targetField, "type": args.type, }, opts); } /** * A collection of arguments for invoking ElasticsearchIngestProcessorConvert. */ export interface ElasticsearchIngestProcessorConvertArgs { /** * Description of the processor. */ description?: string; /** * The field whose value is to be converted. */ field: string; /** * Conditionally execute the processor */ if?: string; /** * Ignore failures for the processor. */ ignoreFailure?: boolean; /** * If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document. */ ignoreMissing?: boolean; /** * Handle failures for the processor. */ onFailures?: string[]; /** * Identifier for the processor. */ tag?: string; /** * The field to assign the converted value to. */ targetField?: string; /** * The type to convert the existing value to */ type: string; } /** * A collection of values returned by ElasticsearchIngestProcessorConvert. */ export interface ElasticsearchIngestProcessorConvertResult { /** * Description of the processor. */ readonly description?: string; /** * The field whose value is to be converted. */ readonly field: string; /** * Internal identifier of the resource */ readonly id: string; /** * Conditionally execute the processor */ readonly if?: string; /** * Ignore failures for the processor. */ readonly ignoreFailure?: boolean; /** * If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document. */ readonly ignoreMissing?: boolean; /** * JSON representation of this data source. */ readonly json: string; /** * Handle failures for the processor. */ readonly onFailures?: string[]; /** * Identifier for the processor. */ readonly tag?: string; /** * The field to assign the converted value to. */ readonly targetField?: string; /** * The type to convert the existing value to */ readonly type: string; } export function elasticsearchIngestProcessorConvertOutput(args: ElasticsearchIngestProcessorConvertOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply(a => elasticsearchIngestProcessorConvert(a, opts)) } /** * A collection of arguments for invoking ElasticsearchIngestProcessorConvert. */ export interface ElasticsearchIngestProcessorConvertOutputArgs { /** * Description of the processor. */ description?: pulumi.Input; /** * The field whose value is to be converted. */ field: pulumi.Input; /** * Conditionally execute the processor */ if?: pulumi.Input; /** * Ignore failures for the processor. */ ignoreFailure?: pulumi.Input; /** * If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document. */ ignoreMissing?: pulumi.Input; /** * Handle failures for the processor. */ onFailures?: pulumi.Input[]>; /** * Identifier for the processor. */ tag?: pulumi.Input; /** * The field to assign the converted value to. */ targetField?: pulumi.Input; /** * The type to convert the existing value to */ type: pulumi.Input; }