WARNING: Version 5.0 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Script Processor
editScript Processor
editAllows inline, stored, and file scripts to be executed within ingest pipelines.
See How to use scripts to learn more about writing scripts. The Script Processor leverages caching of compiled scripts for improved performance. Since the script specified within the processor is potentially re-compiled per document, it is important to understand how script caching works. To learn more about caching see Script Caching.
Table 27. Script Options
Name | Required | Default | Description |
---|---|---|---|
|
no |
"painless" |
The scripting language |
|
no |
- |
The script file to refer to |
|
no |
- |
The stored script id to refer to |
|
no |
- |
An inline script to be executed |
|
no |
- |
Script Parameters |
One of file
, id
, inline
options must be provided in order to properly reference a script to execute.
You can access the current ingest document from within the script context by using the ctx
variable.
The following example sets a new field called field_a_plus_b_times_c
to be the sum of two existing
numeric fields field_a
and field_b
multiplied by the parameter param_c:
{ "script": { "lang": "painless", "inline": "ctx.field_a_plus_b_times_c = (ctx.field_a + ctx.field_b) * params.param_c", "params": { "param_c": 10 } } }