elasticstack 0.13.0 published on Wednesday, Dec 10, 2025 by elastic
elasticstack 0.13.0 published on Wednesday, Dec 10, 2025 by elastic
Helper data source which can be used to create the configuration for a script processor. This processor runs an inline or stored script on incoming documents. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/script-processor.html
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as elasticstack from "@pulumi/elasticstack";
const script = elasticstack.getElasticsearchIngestProcessorScript({
description: "Extract 'tags' from 'env' field",
lang: "painless",
source: `String[] envSplit = ctx['env'].splitOnToken(params['delimiter']);
ArrayList tags = new ArrayList();
tags.add(envSplit[params['position']].trim());
ctx['tags'] = tags;
`,
params: JSON.stringify({
delimiter: "-",
position: 1,
}),
});
const myIngestPipeline = new elasticstack.ElasticsearchIngestPipeline("my_ingest_pipeline", {
name: "script-ingest",
processors: [script.then(script => script.json)],
});
import pulumi
import json
import pulumi_elasticstack as elasticstack
script = elasticstack.get_elasticsearch_ingest_processor_script(description="Extract 'tags' from 'env' field",
lang="painless",
source="""String[] envSplit = ctx['env'].splitOnToken(params['delimiter']);
ArrayList tags = new ArrayList();
tags.add(envSplit[params['position']].trim());
ctx['tags'] = tags;
""",
params=json.dumps({
"delimiter": "-",
"position": 1,
}))
my_ingest_pipeline = elasticstack.ElasticsearchIngestPipeline("my_ingest_pipeline",
name="script-ingest",
processors=[script.json])
package main
import (
"encoding/json"
"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 {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"delimiter": "-",
"position": 1,
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
script, err := elasticstack.GetElasticsearchIngestProcessorScript(ctx, &elasticstack.GetElasticsearchIngestProcessorScriptArgs{
Description: pulumi.StringRef("Extract 'tags' from 'env' field"),
Lang: pulumi.StringRef("painless"),
Source: pulumi.StringRef("String[] envSplit = ctx['env'].splitOnToken(params['delimiter']);\nArrayList tags = new ArrayList();\ntags.add(envSplit[params['position']].trim());\nctx['tags'] = tags;\n"),
Params: pulumi.StringRef(json0),
}, nil)
if err != nil {
return err
}
_, err = elasticstack.NewElasticsearchIngestPipeline(ctx, "my_ingest_pipeline", &elasticstack.ElasticsearchIngestPipelineArgs{
Name: pulumi.String("script-ingest"),
Processors: pulumi.StringArray{
pulumi.String(script.Json),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Elasticstack = Pulumi.Elasticstack;
return await Deployment.RunAsync(() =>
{
var script = Elasticstack.GetElasticsearchIngestProcessorScript.Invoke(new()
{
Description = "Extract 'tags' from 'env' field",
Lang = "painless",
Source = @"String[] envSplit = ctx['env'].splitOnToken(params['delimiter']);
ArrayList tags = new ArrayList();
tags.add(envSplit[params['position']].trim());
ctx['tags'] = tags;
",
Params = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["delimiter"] = "-",
["position"] = 1,
}),
});
var myIngestPipeline = new Elasticstack.ElasticsearchIngestPipeline("my_ingest_pipeline", new()
{
Name = "script-ingest",
Processors = new[]
{
script.Apply(getElasticsearchIngestProcessorScriptResult => getElasticsearchIngestProcessorScriptResult.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.GetElasticsearchIngestProcessorScriptArgs;
import com.pulumi.elasticstack.ElasticsearchIngestPipeline;
import com.pulumi.elasticstack.ElasticsearchIngestPipelineArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 script = ElasticstackFunctions.getElasticsearchIngestProcessorScript(GetElasticsearchIngestProcessorScriptArgs.builder()
.description("Extract 'tags' from 'env' field")
.lang("painless")
.source("""
String[] envSplit = ctx['env'].splitOnToken(params['delimiter']);
ArrayList tags = new ArrayList();
tags.add(envSplit[params['position']].trim());
ctx['tags'] = tags;
""")
.params(serializeJson(
jsonObject(
jsonProperty("delimiter", "-"),
jsonProperty("position", 1)
)))
.build());
var myIngestPipeline = new ElasticsearchIngestPipeline("myIngestPipeline", ElasticsearchIngestPipelineArgs.builder()
.name("script-ingest")
.processors(script.json())
.build());
}
}
resources:
myIngestPipeline:
type: elasticstack:ElasticsearchIngestPipeline
name: my_ingest_pipeline
properties:
name: script-ingest
processors:
- ${script.json}
variables:
script:
fn::invoke:
function: elasticstack:getElasticsearchIngestProcessorScript
arguments:
description: Extract 'tags' from 'env' field
lang: painless
source: |
String[] envSplit = ctx['env'].splitOnToken(params['delimiter']);
ArrayList tags = new ArrayList();
tags.add(envSplit[params['position']].trim());
ctx['tags'] = tags;
params:
fn::toJSON:
delimiter: '-'
position: 1
Using getElasticsearchIngestProcessorScript
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 getElasticsearchIngestProcessorScript(args: GetElasticsearchIngestProcessorScriptArgs, opts?: InvokeOptions): Promise<GetElasticsearchIngestProcessorScriptResult>
function getElasticsearchIngestProcessorScriptOutput(args: GetElasticsearchIngestProcessorScriptOutputArgs, opts?: InvokeOptions): Output<GetElasticsearchIngestProcessorScriptResult>def get_elasticsearch_ingest_processor_script(description: Optional[str] = None,
if_: Optional[str] = None,
ignore_failure: Optional[bool] = None,
lang: Optional[str] = None,
on_failures: Optional[Sequence[str]] = None,
params: Optional[str] = None,
script_id: Optional[str] = None,
source: Optional[str] = None,
tag: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetElasticsearchIngestProcessorScriptResult
def get_elasticsearch_ingest_processor_script_output(description: Optional[pulumi.Input[str]] = None,
if_: Optional[pulumi.Input[str]] = None,
ignore_failure: Optional[pulumi.Input[bool]] = None,
lang: Optional[pulumi.Input[str]] = None,
on_failures: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
params: Optional[pulumi.Input[str]] = None,
script_id: Optional[pulumi.Input[str]] = None,
source: Optional[pulumi.Input[str]] = None,
tag: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetElasticsearchIngestProcessorScriptResult]func GetElasticsearchIngestProcessorScript(ctx *Context, args *GetElasticsearchIngestProcessorScriptArgs, opts ...InvokeOption) (*GetElasticsearchIngestProcessorScriptResult, error)
func GetElasticsearchIngestProcessorScriptOutput(ctx *Context, args *GetElasticsearchIngestProcessorScriptOutputArgs, opts ...InvokeOption) GetElasticsearchIngestProcessorScriptResultOutput> Note: This function is named GetElasticsearchIngestProcessorScript in the Go SDK.
public static class GetElasticsearchIngestProcessorScript
{
public static Task<GetElasticsearchIngestProcessorScriptResult> InvokeAsync(GetElasticsearchIngestProcessorScriptArgs args, InvokeOptions? opts = null)
public static Output<GetElasticsearchIngestProcessorScriptResult> Invoke(GetElasticsearchIngestProcessorScriptInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetElasticsearchIngestProcessorScriptResult> getElasticsearchIngestProcessorScript(GetElasticsearchIngestProcessorScriptArgs args, InvokeOptions options)
public static Output<GetElasticsearchIngestProcessorScriptResult> getElasticsearchIngestProcessorScript(GetElasticsearchIngestProcessorScriptArgs args, InvokeOptions options)
fn::invoke:
function: elasticstack:index/getElasticsearchIngestProcessorScript:getElasticsearchIngestProcessorScript
arguments:
# arguments dictionaryThe following arguments are supported:
- Description string
- Description of the processor.
- If string
- Conditionally execute the processor
- Ignore
Failure bool - Ignore failures for the processor.
- Lang string
- Script language.
- On
Failures List<string> - Handle failures for the processor.
- Params string
- Object containing parameters for the script.
- Script
Id string - ID of a stored script. If no
sourceis specified, this parameter is required. - Source string
- Inline script. If no id is specified, this parameter is required.
- Tag string
- Identifier for the processor.
- Description string
- Description of the processor.
- If string
- Conditionally execute the processor
- Ignore
Failure bool - Ignore failures for the processor.
- Lang string
- Script language.
- On
Failures []string - Handle failures for the processor.
- Params string
- Object containing parameters for the script.
- Script
Id string - ID of a stored script. If no
sourceis specified, this parameter is required. - Source string
- Inline script. If no id is specified, this parameter is required.
- Tag string
- Identifier for the processor.
- description String
- Description of the processor.
- if_ String
- Conditionally execute the processor
- ignore
Failure Boolean - Ignore failures for the processor.
- lang String
- Script language.
- on
Failures List<String> - Handle failures for the processor.
- params String
- Object containing parameters for the script.
- script
Id String - ID of a stored script. If no
sourceis specified, this parameter is required. - source String
- Inline script. If no id is specified, this parameter is required.
- tag String
- Identifier for the processor.
- description string
- Description of the processor.
- if string
- Conditionally execute the processor
- ignore
Failure boolean - Ignore failures for the processor.
- lang string
- Script language.
- on
Failures string[] - Handle failures for the processor.
- params string
- Object containing parameters for the script.
- script
Id string - ID of a stored script. If no
sourceis specified, this parameter is required. - source string
- Inline script. If no id is specified, this parameter is required.
- tag string
- Identifier for the processor.
- description str
- Description of the processor.
- if_ str
- Conditionally execute the processor
- ignore_
failure bool - Ignore failures for the processor.
- lang str
- Script language.
- on_
failures Sequence[str] - Handle failures for the processor.
- params str
- Object containing parameters for the script.
- script_
id str - ID of a stored script. If no
sourceis specified, this parameter is required. - source str
- Inline script. If no id is specified, this parameter is required.
- tag str
- Identifier for the processor.
- description String
- Description of the processor.
- if String
- Conditionally execute the processor
- ignore
Failure Boolean - Ignore failures for the processor.
- lang String
- Script language.
- on
Failures List<String> - Handle failures for the processor.
- params String
- Object containing parameters for the script.
- script
Id String - ID of a stored script. If no
sourceis specified, this parameter is required. - source String
- Inline script. If no id is specified, this parameter is required.
- tag String
- Identifier for the processor.
getElasticsearchIngestProcessorScript Result
The following output properties are available:
- 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
- Ignore
Failure bool - Ignore failures for the processor.
- Lang string
- Script language.
- On
Failures List<string> - Handle failures for the processor.
- Params string
- Object containing parameters for the script.
- Script
Id string - ID of a stored script. If no
sourceis specified, this parameter is required. - Source string
- Inline script. If no id is specified, this parameter is required.
- Tag string
- Identifier for the processor.
- 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
- Ignore
Failure bool - Ignore failures for the processor.
- Lang string
- Script language.
- On
Failures []string - Handle failures for the processor.
- Params string
- Object containing parameters for the script.
- Script
Id string - ID of a stored script. If no
sourceis specified, this parameter is required. - Source string
- Inline script. If no id is specified, this parameter is required.
- Tag string
- Identifier for the processor.
- 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
- ignore
Failure Boolean - Ignore failures for the processor.
- lang String
- Script language.
- on
Failures List<String> - Handle failures for the processor.
- params String
- Object containing parameters for the script.
- script
Id String - ID of a stored script. If no
sourceis specified, this parameter is required. - source String
- Inline script. If no id is specified, this parameter is required.
- tag String
- Identifier for the processor.
- 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
- ignore
Failure boolean - Ignore failures for the processor.
- lang string
- Script language.
- on
Failures string[] - Handle failures for the processor.
- params string
- Object containing parameters for the script.
- script
Id string - ID of a stored script. If no
sourceis specified, this parameter is required. - source string
- Inline script. If no id is specified, this parameter is required.
- tag string
- Identifier for the processor.
- 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.
- lang str
- Script language.
- on_
failures Sequence[str] - Handle failures for the processor.
- params str
- Object containing parameters for the script.
- script_
id str - ID of a stored script. If no
sourceis specified, this parameter is required. - source str
- Inline script. If no id is specified, this parameter is required.
- tag str
- Identifier for the processor.
- 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
- ignore
Failure Boolean - Ignore failures for the processor.
- lang String
- Script language.
- on
Failures List<String> - Handle failures for the processor.
- params String
- Object containing parameters for the script.
- script
Id String - ID of a stored script. If no
sourceis specified, this parameter is required. - source String
- Inline script. If no id is specified, this parameter is required.
- tag String
- Identifier for the processor.
Package Details
- Repository
- elasticstack elastic/terraform-provider-elasticstack
- License
- Notes
- This Pulumi package is based on the
elasticstackTerraform Provider.
elasticstack 0.13.0 published on Wednesday, Dec 10, 2025 by elastic
