2016-05-05 00:17:10 +08:00
|
|
|
[[modules-scripting]]
|
2019-06-06 22:45:04 +08:00
|
|
|
= Scripting
|
2013-08-29 07:24:34 +08:00
|
|
|
|
2019-06-06 22:45:04 +08:00
|
|
|
[partintro]
|
|
|
|
--
|
|
|
|
With scripting, you can evaluate custom expressions in {es}. For example, you
|
2021-03-19 03:58:33 +08:00
|
|
|
can use a script to return a computed value as a field or evaluate a custom
|
|
|
|
score for a query.
|
2016-05-05 00:17:10 +08:00
|
|
|
|
2021-03-19 03:58:33 +08:00
|
|
|
The default scripting language is <<modules-scripting-painless,Painless>>.
|
|
|
|
Additional `lang` plugins are available to run scripts written in other
|
|
|
|
languages. You can specify the language of the script anywhere that scripts run.
|
2016-05-05 00:17:10 +08:00
|
|
|
|
2020-07-23 23:48:22 +08:00
|
|
|
[discrete]
|
2021-03-19 03:58:33 +08:00
|
|
|
[[scripting-available-languages]]
|
|
|
|
== Available scripting languages
|
2016-05-05 00:17:10 +08:00
|
|
|
|
2021-03-19 03:58:33 +08:00
|
|
|
Painless is purpose-built for {es}, can be used for any purpose in the
|
|
|
|
scripting APIs, and provides the most flexibility. The other languages are less
|
|
|
|
flexible, but can be useful for specific purposes.
|
2016-05-05 00:17:10 +08:00
|
|
|
|
|
|
|
[cols="<,<,<,<",options="header",]
|
2021-03-19 03:58:33 +08:00
|
|
|
|========
|
2016-05-05 00:17:10 +08:00
|
|
|
|Language
|
|
|
|
|Sandboxed
|
|
|
|
|Required plugin
|
|
|
|
|Purpose
|
|
|
|
|
2021-03-19 03:58:33 +08:00
|
|
|
|<<modules-scripting-painless,`painless`>>
|
|
|
|
|{yes-icon}
|
|
|
|
|Built-in
|
|
|
|
|Purpose-built for {es}
|
|
|
|
|
2016-05-05 00:17:10 +08:00
|
|
|
|<<modules-scripting-expression, `expression`>>
|
2021-03-19 03:58:33 +08:00
|
|
|
|{yes-icon}
|
|
|
|
|Built-in
|
|
|
|
|Fast custom ranking and sorting
|
2016-05-05 00:17:10 +08:00
|
|
|
|
|
|
|
|<<search-template, `mustache`>>
|
2021-03-19 03:58:33 +08:00
|
|
|
|{yes-icon}
|
|
|
|
|Built-in
|
|
|
|
|Templates
|
2016-05-05 00:17:10 +08:00
|
|
|
|
2017-05-12 03:15:16 +08:00
|
|
|
|<<modules-scripting-engine, `java`>>
|
2021-03-19 03:58:33 +08:00
|
|
|
|{no-icon}
|
|
|
|
|You write it!
|
|
|
|
|Expert API
|
|
|
|
|========
|
2016-05-05 00:17:10 +08:00
|
|
|
|
2019-06-06 22:45:04 +08:00
|
|
|
--
|
2016-05-05 00:17:10 +08:00
|
|
|
|
2021-03-19 03:58:33 +08:00
|
|
|
include::scripting/painless.asciidoc[]
|
|
|
|
|
2016-05-05 00:17:10 +08:00
|
|
|
include::scripting/using.asciidoc[]
|
|
|
|
|
2022-02-04 04:15:38 +08:00
|
|
|
include::scripting/access-fields.asciidoc[]
|
|
|
|
|
2021-05-27 19:38:55 +08:00
|
|
|
include::scripting/common-script-uses.asciidoc[]
|
|
|
|
|
2016-05-05 00:17:10 +08:00
|
|
|
include::scripting/fields.asciidoc[]
|
2013-08-29 07:24:34 +08:00
|
|
|
|
2016-01-31 21:54:17 +08:00
|
|
|
include::scripting/security.asciidoc[]
|
2016-05-05 00:17:10 +08:00
|
|
|
|
|
|
|
include::scripting/expression.asciidoc[]
|
|
|
|
|
2017-05-12 03:15:16 +08:00
|
|
|
include::scripting/engine.asciidoc[]
|