elasticstack.getElasticsearchIngestProcessorConvert
Explore with Pulumi AI
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, target_field
will be updated with the unconverted field value.
See: https://www.elastic.co/guide/en/elasticsearch/reference/current/convert-processor.html
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as elasticstack from "@pulumi/elasticstack";
const convert = elasticstack.getElasticsearchIngestProcessorConvert({
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)]});
import pulumi
import pulumi_elasticstack as elasticstack
convert = elasticstack.get_elasticsearch_ingest_processor_convert(description="converts the content of the id field to an integer",
field="id",
type="integer")
my_ingest_pipeline = elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", processors=[convert.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 {
convert, err := elasticstack.GetElasticsearchIngestProcessorConvert(ctx, &elasticstack.GetElasticsearchIngestProcessorConvertArgs{
Description: pulumi.StringRef("converts the content of the id field to an integer"),
Field: "id",
Type: "integer",
}, nil)
if err != nil {
return err
}
_, err = elasticstack.NewElasticsearchIngestPipeline(ctx, "myIngestPipeline", &elasticstack.ElasticsearchIngestPipelineArgs{
Processors: pulumi.StringArray{
pulumi.String(convert.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 convert = Elasticstack.GetElasticsearchIngestProcessorConvert.Invoke(new()
{
Description = "converts the content of the id field to an integer",
Field = "id",
Type = "integer",
});
var myIngestPipeline = new Elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", new()
{
Processors = new[]
{
convert.Apply(getElasticsearchIngestProcessorConvertResult => getElasticsearchIngestProcessorConvertResult.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.GetElasticsearchIngestProcessorConvertArgs;
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 convert = ElasticstackFunctions.getElasticsearchIngestProcessorConvert(GetElasticsearchIngestProcessorConvertArgs.builder()
.description("converts the content of the id field to an integer")
.field("id")
.type("integer")
.build());
var myIngestPipeline = new ElasticsearchIngestPipeline("myIngestPipeline", ElasticsearchIngestPipelineArgs.builder()
.processors(convert.applyValue(getElasticsearchIngestProcessorConvertResult -> getElasticsearchIngestProcessorConvertResult.json()))
.build());
}
}
resources:
myIngestPipeline:
type: elasticstack:ElasticsearchIngestPipeline
properties:
processors:
- ${convert.json}
variables:
convert:
fn::invoke:
function: elasticstack:getElasticsearchIngestProcessorConvert
arguments:
description: converts the content of the id field to an integer
field: id
type: integer
Using getElasticsearchIngestProcessorConvert
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 getElasticsearchIngestProcessorConvert(args: GetElasticsearchIngestProcessorConvertArgs, opts?: InvokeOptions): Promise<GetElasticsearchIngestProcessorConvertResult>
function getElasticsearchIngestProcessorConvertOutput(args: GetElasticsearchIngestProcessorConvertOutputArgs, opts?: InvokeOptions): Output<GetElasticsearchIngestProcessorConvertResult>
def get_elasticsearch_ingest_processor_convert(description: 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,
tag: Optional[str] = None,
target_field: Optional[str] = None,
type: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetElasticsearchIngestProcessorConvertResult
def get_elasticsearch_ingest_processor_convert_output(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,
ignore_missing: Optional[pulumi.Input[bool]] = None,
on_failures: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
tag: Optional[pulumi.Input[str]] = None,
target_field: Optional[pulumi.Input[str]] = None,
type: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetElasticsearchIngestProcessorConvertResult]
func GetElasticsearchIngestProcessorConvert(ctx *Context, args *GetElasticsearchIngestProcessorConvertArgs, opts ...InvokeOption) (*GetElasticsearchIngestProcessorConvertResult, error)
func GetElasticsearchIngestProcessorConvertOutput(ctx *Context, args *GetElasticsearchIngestProcessorConvertOutputArgs, opts ...InvokeOption) GetElasticsearchIngestProcessorConvertResultOutput
> Note: This function is named GetElasticsearchIngestProcessorConvert
in the Go SDK.
public static class GetElasticsearchIngestProcessorConvert
{
public static Task<GetElasticsearchIngestProcessorConvertResult> InvokeAsync(GetElasticsearchIngestProcessorConvertArgs args, InvokeOptions? opts = null)
public static Output<GetElasticsearchIngestProcessorConvertResult> Invoke(GetElasticsearchIngestProcessorConvertInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetElasticsearchIngestProcessorConvertResult> getElasticsearchIngestProcessorConvert(GetElasticsearchIngestProcessorConvertArgs args, InvokeOptions options)
public static Output<GetElasticsearchIngestProcessorConvertResult> getElasticsearchIngestProcessorConvert(GetElasticsearchIngestProcessorConvertArgs args, InvokeOptions options)
fn::invoke:
function: elasticstack:index/getElasticsearchIngestProcessorConvert:getElasticsearchIngestProcessorConvert
arguments:
# arguments dictionary
The following arguments are supported:
- Field string
- The field whose value is to be converted.
- Type string
- The type to convert the existing value to
- Description string
- Description of the processor.
- If string
- Conditionally execute the processor
- Ignore
Failure bool - Ignore failures for the processor.
- Ignore
Missing bool - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - On
Failures List<string> - Handle failures for the processor.
- Tag string
- Identifier for the processor.
- Target
Field string - The field to assign the converted value to.
- Field string
- The field whose value is to be converted.
- Type string
- The type to convert the existing value to
- Description string
- Description of the processor.
- If string
- Conditionally execute the processor
- Ignore
Failure bool - Ignore failures for the processor.
- Ignore
Missing bool - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - On
Failures []string - Handle failures for the processor.
- Tag string
- Identifier for the processor.
- Target
Field string - The field to assign the converted value to.
- field String
- The field whose value is to be converted.
- type String
- The type to convert the existing value to
- description String
- Description of the processor.
- if_ String
- Conditionally execute the processor
- ignore
Failure Boolean - Ignore failures for the processor.
- ignore
Missing Boolean - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - on
Failures List<String> - Handle failures for the processor.
- tag String
- Identifier for the processor.
- target
Field String - The field to assign the converted value to.
- field string
- The field whose value is to be converted.
- type string
- The type to convert the existing value to
- description string
- Description of the processor.
- if string
- Conditionally execute the processor
- ignore
Failure boolean - Ignore failures for the processor.
- ignore
Missing boolean - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - on
Failures string[] - Handle failures for the processor.
- tag string
- Identifier for the processor.
- target
Field string - The field to assign the converted value to.
- field str
- The field whose value is to be converted.
- type str
- The type to convert the existing value to
- description str
- Description of the processor.
- if_ str
- Conditionally execute the processor
- ignore_
failure bool - Ignore failures for the processor.
- ignore_
missing bool - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - on_
failures Sequence[str] - Handle failures for the processor.
- tag str
- Identifier for the processor.
- target_
field str - The field to assign the converted value to.
- field String
- The field whose value is to be converted.
- type String
- The type to convert the existing value to
- description String
- Description of the processor.
- if String
- Conditionally execute the processor
- ignore
Failure Boolean - Ignore failures for the processor.
- ignore
Missing Boolean - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - on
Failures List<String> - Handle failures for the processor.
- tag String
- Identifier for the processor.
- target
Field String - The field to assign the converted value to.
getElasticsearchIngestProcessorConvert Result
The following output properties are available:
- Field string
- The field whose value is to be converted.
- Id string
- Internal identifier of the resource
- Json string
- JSON representation of this data source.
- Type string
- The type to convert the existing value to
- Description string
- Description of the processor.
- If string
- Conditionally execute the processor
- Ignore
Failure bool - Ignore failures for the processor.
- Ignore
Missing bool - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - On
Failures List<string> - Handle failures for the processor.
- Tag string
- Identifier for the processor.
- Target
Field string - The field to assign the converted value to.
- Field string
- The field whose value is to be converted.
- Id string
- Internal identifier of the resource
- Json string
- JSON representation of this data source.
- Type string
- The type to convert the existing value to
- Description string
- Description of the processor.
- If string
- Conditionally execute the processor
- Ignore
Failure bool - Ignore failures for the processor.
- Ignore
Missing bool - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - On
Failures []string - Handle failures for the processor.
- Tag string
- Identifier for the processor.
- Target
Field string - The field to assign the converted value to.
- field String
- The field whose value is to be converted.
- id String
- Internal identifier of the resource
- json String
- JSON representation of this data source.
- type String
- The type to convert the existing value to
- description String
- Description of the processor.
- if_ String
- Conditionally execute the processor
- ignore
Failure Boolean - Ignore failures for the processor.
- ignore
Missing Boolean - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - on
Failures List<String> - Handle failures for the processor.
- tag String
- Identifier for the processor.
- target
Field String - The field to assign the converted value to.
- field string
- The field whose value is to be converted.
- id string
- Internal identifier of the resource
- json string
- JSON representation of this data source.
- type string
- The type to convert the existing value to
- description string
- Description of the processor.
- if string
- Conditionally execute the processor
- ignore
Failure boolean - Ignore failures for the processor.
- ignore
Missing boolean - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - on
Failures string[] - Handle failures for the processor.
- tag string
- Identifier for the processor.
- target
Field string - The field to assign the converted value to.
- field str
- The field whose value is to be converted.
- id str
- Internal identifier of the resource
- json str
- JSON representation of this data source.
- type str
- The type to convert the existing value to
- description str
- Description of the processor.
- if_ str
- Conditionally execute the processor
- ignore_
failure bool - Ignore failures for the processor.
- ignore_
missing bool - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - on_
failures Sequence[str] - Handle failures for the processor.
- tag str
- Identifier for the processor.
- target_
field str - The field to assign the converted value to.
- field String
- The field whose value is to be converted.
- id String
- Internal identifier of the resource
- json String
- JSON representation of this data source.
- type String
- The type to convert the existing value to
- description String
- Description of the processor.
- if String
- Conditionally execute the processor
- ignore
Failure Boolean - Ignore failures for the processor.
- ignore
Missing Boolean - If
true
andfield
does not exist or isnull
, the processor quietly exits without modifying the document. - on
Failures List<String> - Handle failures for the processor.
- tag String
- Identifier for the processor.
- target
Field String - The field to assign the converted value to.
Package Details
- Repository
- elasticstack elastic/terraform-provider-elasticstack
- License
- Notes
- This Pulumi package is based on the
elasticstack
Terraform Provider.