WARNING: Version 5.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
editScripting
editThe scripting module enables you to use scripts to evaluate custom expressions. For example, you could use a script to return "script fields" as part of a search request or evaluate a custom score for a query.
The default scripting language is Painless
.
Additional lang
plugins enable you to run scripts written in other languages.
Everywhere a script can be used, you can include a lang
parameter
to specify the language of the script.
General-purpose languages:
editThese languages can be used for any purpose in the scripting APIs, and give the most flexibility.
Language | Sandboxed | Required plugin |
---|---|---|
yes |
built-in |
|
built-in |
||
Special-purpose languages:
editThese languages are less flexible, but typically have higher performance for certain tasks.
Language | Sandboxed | Required plugin | Purpose |
---|---|---|---|
yes |
built-in |
fast custom ranking and sorting |
|
yes |
built-in |
templates |
|
n/a |
you write it! |
expert API |
Scripts and security
Languages that are sandboxed are designed with security in mind. However, non- sandboxed languages can be a security issue, please read Scripting and security for more details.