// This file is autogenerated, DO NOT EDIT
// ingest/processors/script.asciidoc:48

[source, python]
----
resp = client.ingest.simulate(
    pipeline={
        "processors": [
            {
                "script": {
                    "description": "Extract 'tags' from 'env' field",
                    "lang": "painless",
                    "source": "\n            String[] envSplit = ctx['env'].splitOnToken(params['delimiter']);\n            ArrayList tags = new ArrayList();\n            tags.add(envSplit[params['position']].trim());\n            ctx['tags'] = tags;\n          ",
                    "params": {
                        "delimiter": "-",
                        "position": 1
                    }
                }
            }
        ]
    },
    docs=[
        {
            "_source": {
                "env": "es01-prod"
            }
        }
    ],
)
print(resp)
----
