WARNING: Version 2.4 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.
Scripting changes
editScripting changes
editScripting syntax
editThe syntax for scripts has been made consistent across all APIs. The accepted format is as follows:
- Inline/Dynamic scripts
- Indexed scripts
- File scripts
For example, an update request might look like this:
POST my_index/my_type/1/_update { "script": { "inline": "ctx._source.count += val", "params": { "val": 3 } }, "upsert": { "count": 0 } }
A short syntax exists for running inline scripts in the default scripting language without any parameters:
GET _search { "script_fields": { "concat_fields": { "script": "doc['one'].value + ' ' + doc['two'].value" } } }
Scripting settings
editThe script.disable_dynamic
node setting has been replaced by fine-grained
script settings described in Scripting settings.
Groovy scripts sandbox
editThe Groovy sandbox and related settings have been removed. Groovy is now a non-sandboxed scripting language, without any option to turn the sandbox on.
Plugins making use of scripts
editPlugins that make use of scripts must register their own script context
through ScriptModule
. Script contexts can be used as part of fine-grained
settings to enable/disable scripts selectively.