elasticstack.getElasticsearchIngestProcessorForeach
Explore with Pulumi AI
Runs an ingest processor on each element of an array or object.
All ingest processors can run on array or object elements. However, if the number of elements is unknown, it can be cumbersome to process each one in the same way.
The foreach
processor lets you specify a field
containing array or object values and a processor
to run on each element in the field.
See: https://www.elastic.co/guide/en/elasticsearch/reference/current/foreach-processor.html
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as elasticstack from "@pulumi/elasticstack";
const convert = elasticstack.getElasticsearchIngestProcessorConvert({
field: "_ingest._value",
type: "integer",
});
const foreach = convert.then(convert => elasticstack.getElasticsearchIngestProcessorForeach({
field: "values",
processor: convert.json,
}));
const myIngestPipeline = new elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", {processors: [foreach.then(foreach => foreach.json)]});
import pulumi
import pulumi_elasticstack as elasticstack
convert = elasticstack.get_elasticsearch_ingest_processor_convert(field="_ingest._value",
type="integer")
foreach = elasticstack.get_elasticsearch_ingest_processor_foreach(field="values",
processor=convert.json)
my_ingest_pipeline = elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", processors=[foreach.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{
Field: "_ingest._value",
Type: "integer",
}, nil)
if err != nil {
return err
}
foreach, err := elasticstack.GetElasticsearchIngestProcessorForeach(ctx, &elasticstack.GetElasticsearchIngestProcessorForeachArgs{
Field: "values",
Processor: convert.Json,
}, nil)
if err != nil {
return err
}
_, err = elasticstack.NewElasticsearchIngestPipeline(ctx, "myIngestPipeline", &elasticstack.ElasticsearchIngestPipelineArgs{
Processors: pulumi.StringArray{
pulumi.String(foreach.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()
{
Field = "_ingest._value",
Type = "integer",
});
var @foreach = Elasticstack.GetElasticsearchIngestProcessorForeach.Invoke(new()
{
Field = "values",
Processor = convert.Apply(getElasticsearchIngestProcessorConvertResult => getElasticsearchIngestProcessorConvertResult.Json),
});
var myIngestPipeline = new Elasticstack.ElasticsearchIngestPipeline("myIngestPipeline", new()
{
Processors = new[]
{
@foreach.Apply(@foreach => @foreach.Apply(getElasticsearchIngestProcessorForeachResult => getElasticsearchIngestProcessorForeachResult.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.inputs.GetElasticsearchIngestProcessorForeachArgs;
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()
.field("_ingest._value")
.type("integer")
.build());
final var foreach = ElasticstackFunctions.getElasticsearchIngestProcessorForeach(GetElasticsearchIngestProcessorForeachArgs.builder()
.field("values")
.processor(convert.applyValue(getElasticsearchIngestProcessorConvertResult -> getElasticsearchIngestProcessorConvertResult.json()))
.build());
var myIngestPipeline = new ElasticsearchIngestPipeline("myIngestPipeline", ElasticsearchIngestPipelineArgs.builder()
.processors(foreach.applyValue(getElasticsearchIngestProcessorForeachResult -> getElasticsearchIngestProcessorForeachResult.json()))
.build());
}
}
resources:
myIngestPipeline:
type: elasticstack:ElasticsearchIngestPipeline
properties:
processors:
- ${foreach.json}
variables:
convert:
fn::invoke:
function: elasticstack:getElasticsearchIngestProcessorConvert
arguments:
field: _ingest._value
type: integer
foreach:
fn::invoke:
function: elasticstack:getElasticsearchIngestProcessorForeach
arguments:
field: values
processor: ${convert.json}
Using getElasticsearchIngestProcessorForeach
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 getElasticsearchIngestProcessorForeach(args: GetElasticsearchIngestProcessorForeachArgs, opts?: InvokeOptions): Promise<GetElasticsearchIngestProcessorForeachResult>
function getElasticsearchIngestProcessorForeachOutput(args: GetElasticsearchIngestProcessorForeachOutputArgs, opts?: InvokeOptions): Output<GetElasticsearchIngestProcessorForeachResult>
def get_elasticsearch_ingest_processor_foreach(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,
processor: Optional[str] = None,
tag: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetElasticsearchIngestProcessorForeachResult
def get_elasticsearch_ingest_processor_foreach_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,
processor: Optional[pulumi.Input[str]] = None,
tag: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetElasticsearchIngestProcessorForeachResult]
func GetElasticsearchIngestProcessorForeach(ctx *Context, args *GetElasticsearchIngestProcessorForeachArgs, opts ...InvokeOption) (*GetElasticsearchIngestProcessorForeachResult, error)
func GetElasticsearchIngestProcessorForeachOutput(ctx *Context, args *GetElasticsearchIngestProcessorForeachOutputArgs, opts ...InvokeOption) GetElasticsearchIngestProcessorForeachResultOutput
> Note: This function is named GetElasticsearchIngestProcessorForeach
in the Go SDK.
public static class GetElasticsearchIngestProcessorForeach
{
public static Task<GetElasticsearchIngestProcessorForeachResult> InvokeAsync(GetElasticsearchIngestProcessorForeachArgs args, InvokeOptions? opts = null)
public static Output<GetElasticsearchIngestProcessorForeachResult> Invoke(GetElasticsearchIngestProcessorForeachInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetElasticsearchIngestProcessorForeachResult> getElasticsearchIngestProcessorForeach(GetElasticsearchIngestProcessorForeachArgs args, InvokeOptions options)
public static Output<GetElasticsearchIngestProcessorForeachResult> getElasticsearchIngestProcessorForeach(GetElasticsearchIngestProcessorForeachArgs args, InvokeOptions options)
fn::invoke:
function: elasticstack:index/getElasticsearchIngestProcessorForeach:getElasticsearchIngestProcessorForeach
arguments:
# arguments dictionary
The following arguments are supported:
- Field string
- Field containing array or object values.
- Processor string
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - On
Failures List<string> - Handle failures for the processor.
- Tag string
- Identifier for the processor.
- Field string
- Field containing array or object values.
- Processor string
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - On
Failures []string - Handle failures for the processor.
- Tag string
- Identifier for the processor.
- field String
- Field containing array or object values.
- processor String
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - on
Failures List<String> - Handle failures for the processor.
- tag String
- Identifier for the processor.
- field string
- Field containing array or object values.
- processor string
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - on
Failures string[] - Handle failures for the processor.
- tag string
- Identifier for the processor.
- field str
- Field containing array or object values.
- processor str
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - on_
failures Sequence[str] - Handle failures for the processor.
- tag str
- Identifier for the processor.
- field String
- Field containing array or object values.
- processor String
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - on
Failures List<String> - Handle failures for the processor.
- tag String
- Identifier for the processor.
getElasticsearchIngestProcessorForeach Result
The following output properties are available:
- Field string
- Field containing array or object values.
- Id string
- Internal identifier of the resource
- Json string
- JSON representation of this data source.
- Processor string
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - On
Failures List<string> - Handle failures for the processor.
- Tag string
- Identifier for the processor.
- Field string
- Field containing array or object values.
- Id string
- Internal identifier of the resource
- Json string
- JSON representation of this data source.
- Processor string
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - On
Failures []string - Handle failures for the processor.
- Tag string
- Identifier for the processor.
- field String
- Field containing array or object values.
- id String
- Internal identifier of the resource
- json String
- JSON representation of this data source.
- processor String
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - on
Failures List<String> - Handle failures for the processor.
- tag String
- Identifier for the processor.
- field string
- Field containing array or object values.
- id string
- Internal identifier of the resource
- json string
- JSON representation of this data source.
- processor string
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - on
Failures string[] - Handle failures for the processor.
- tag string
- Identifier for the processor.
- field str
- Field containing array or object values.
- id str
- Internal identifier of the resource
- json str
- JSON representation of this data source.
- processor str
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - on_
failures Sequence[str] - Handle failures for the processor.
- tag str
- Identifier for the processor.
- field String
- Field containing array or object values.
- id String
- Internal identifier of the resource
- json String
- JSON representation of this data source.
- processor String
- Ingest processor to run on each element.
- 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
, the processor silently exits without changing the document if thefield
isnull
or missing. - on
Failures List<String> - Handle failures for the processor.
- tag String
- Identifier for the processor.
Package Details
- Repository
- elasticstack elastic/terraform-provider-elasticstack
- License
- Notes
- This Pulumi package is based on the
elasticstack
Terraform Provider.