[DOCS] Move 'Scripting' section to top-level navigation. (#42939)
This commit is contained in:
parent
e35b240a43
commit
2de919e3a8
|
@ -43,6 +43,8 @@ include::cluster.asciidoc[]
|
||||||
|
|
||||||
include::query-dsl.asciidoc[]
|
include::query-dsl.asciidoc[]
|
||||||
|
|
||||||
|
include::scripting.asciidoc[]
|
||||||
|
|
||||||
include::mapping.asciidoc[]
|
include::mapping.asciidoc[]
|
||||||
|
|
||||||
include::analysis.asciidoc[]
|
include::analysis.asciidoc[]
|
||||||
|
|
|
@ -46,20 +46,10 @@ The modules in this section are:
|
||||||
|
|
||||||
A Java node client joins the cluster, but doesn't hold data or act as a master node.
|
A Java node client joins the cluster, but doesn't hold data or act as a master node.
|
||||||
|
|
||||||
<<modules-scripting-painless,Painless>>::
|
|
||||||
|
|
||||||
A built-in scripting language for Elasticsearch that's designed to be as secure as possible.
|
|
||||||
|
|
||||||
<<modules-plugins,Plugins>>::
|
<<modules-plugins,Plugins>>::
|
||||||
|
|
||||||
Using plugins to extend Elasticsearch.
|
Using plugins to extend Elasticsearch.
|
||||||
|
|
||||||
<<modules-scripting,Scripting>>::
|
|
||||||
|
|
||||||
Custom scripting available in Lucene Expressions, ad Groovy. You can also
|
|
||||||
write scripts in the built-in scripting language,
|
|
||||||
<<modules-scripting-painless, Painless>>.
|
|
||||||
|
|
||||||
<<modules-snapshots,Snapshot/Restore>>::
|
<<modules-snapshots,Snapshot/Restore>>::
|
||||||
|
|
||||||
Backup your data with snapshot/restore.
|
Backup your data with snapshot/restore.
|
||||||
|
@ -102,8 +92,6 @@ include::modules/node.asciidoc[]
|
||||||
:edit_url:
|
:edit_url:
|
||||||
include::modules/plugins.asciidoc[]
|
include::modules/plugins.asciidoc[]
|
||||||
|
|
||||||
include::modules/scripting.asciidoc[]
|
|
||||||
|
|
||||||
include::modules/snapshots.asciidoc[]
|
include::modules/snapshots.asciidoc[]
|
||||||
|
|
||||||
include::modules/threadpool.asciidoc[]
|
include::modules/threadpool.asciidoc[]
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
[[modules-scripting]]
|
[[modules-scripting]]
|
||||||
== Scripting
|
= Scripting
|
||||||
|
|
||||||
The scripting module enables you to use scripts to evaluate custom
|
[partintro]
|
||||||
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.
|
With scripting, you can evaluate custom expressions in {es}. 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 <<modules-scripting-painless, `Painless`>>.
|
The default scripting language is <<modules-scripting-painless, `Painless`>>.
|
||||||
Additional `lang` plugins enable you to run scripts written in other languages.
|
Additional `lang` plugins enable you to run scripts written in other languages.
|
||||||
|
@ -11,7 +13,7 @@ Everywhere a script can be used, you can include a `lang` parameter
|
||||||
to specify the language of the script.
|
to specify the language of the script.
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
=== General-purpose languages:
|
== General-purpose languages
|
||||||
|
|
||||||
These languages can be used for any purpose in the scripting APIs,
|
These languages can be used for any purpose in the scripting APIs,
|
||||||
and give the most flexibility.
|
and give the most flexibility.
|
||||||
|
@ -29,7 +31,7 @@ and give the most flexibility.
|
||||||
|=======================================================================
|
|=======================================================================
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
=== Special-purpose languages:
|
== Special-purpose languages
|
||||||
|
|
||||||
These languages are less flexible, but typically have higher performance for
|
These languages are less flexible, but typically have higher performance for
|
||||||
certain tasks.
|
certain tasks.
|
||||||
|
@ -67,7 +69,7 @@ sandboxed languages can be a security issue, please read
|
||||||
<<modules-scripting-security, Scripting and security>> for more details.
|
<<modules-scripting-security, Scripting and security>> for more details.
|
||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
--
|
||||||
|
|
||||||
include::scripting/using.asciidoc[]
|
include::scripting/using.asciidoc[]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[[modules-scripting-engine]]
|
[[modules-scripting-engine]]
|
||||||
=== Advanced scripts using script engines
|
== Advanced scripts using script engines
|
||||||
|
|
||||||
A `ScriptEngine` is a backend for implementing a scripting language. It may also
|
A `ScriptEngine` is a backend for implementing a scripting language. It may also
|
||||||
be used to write scripts that need to use advanced internals of scripting. For example,
|
be used to write scripts that need to use advanced internals of scripting. For example,
|
|
@ -1,5 +1,5 @@
|
||||||
[[modules-scripting-expression]]
|
[[modules-scripting-expression]]
|
||||||
=== Lucene Expressions Language
|
== Lucene expressions language
|
||||||
|
|
||||||
Lucene's expressions compile a `javascript` expression to bytecode. They are
|
Lucene's expressions compile a `javascript` expression to bytecode. They are
|
||||||
designed for high-performance custom ranking and sorting functions and are
|
designed for high-performance custom ranking and sorting functions and are
|
|
@ -1,5 +1,5 @@
|
||||||
[[modules-scripting-fields]]
|
[[modules-scripting-fields]]
|
||||||
=== Accessing document fields and special variables
|
== Accessing document fields and special variables
|
||||||
|
|
||||||
Depending on where a script is used, it will have access to certain special
|
Depending on where a script is used, it will have access to certain special
|
||||||
variables and document fields.
|
variables and document fields.
|
||||||
|
@ -17,7 +17,7 @@ API will have access to the `ctx` variable which exposes:
|
||||||
`ctx._index` etc:: Access to <<mapping-fields,document meta-fields>>, some of which may be read-only.
|
`ctx._index` etc:: Access to <<mapping-fields,document meta-fields>>, some of which may be read-only.
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
== Search and Aggregation scripts
|
== Search and aggregation scripts
|
||||||
|
|
||||||
With the exception of <<search-request-script-fields,script fields>> which are
|
With the exception of <<search-request-script-fields,script fields>> which are
|
||||||
executed once per search hit, scripts used in search and aggregations will be
|
executed once per search hit, scripts used in search and aggregations will be
|
||||||
|
@ -80,7 +80,7 @@ GET my_index/_search
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
[[modules-scripting-doc-vals]]
|
[[modules-scripting-doc-vals]]
|
||||||
=== Doc Values
|
=== Doc values
|
||||||
|
|
||||||
By far the fastest most efficient way to access a field value from a
|
By far the fastest most efficient way to access a field value from a
|
||||||
script is to use the `doc['field_name']` syntax, which retrieves the field
|
script is to use the `doc['field_name']` syntax, which retrieves the field
|
||||||
|
@ -140,7 +140,7 @@ access `text` fields from scripts.
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
[[modules-scripting-stored]]
|
[[modules-scripting-stored]]
|
||||||
=== Stored Fields and `_source`
|
=== Stored fields and `_source`
|
||||||
|
|
||||||
_Stored fields_ -- fields explicitly marked as
|
_Stored fields_ -- fields explicitly marked as
|
||||||
<<mapping-store,`"store": true`>> -- can be accessed using the
|
<<mapping-store,`"store": true`>> -- can be accessed using the
|
|
@ -1,5 +1,5 @@
|
||||||
[[modules-scripting-painless]]
|
[[modules-scripting-painless]]
|
||||||
=== Painless Scripting Language
|
== Painless scripting language
|
||||||
|
|
||||||
_Painless_ is a simple, secure scripting language designed specifically for use
|
_Painless_ is a simple, secure scripting language designed specifically for use
|
||||||
with Elasticsearch. It is the default scripting language for Elasticsearch and
|
with Elasticsearch. It is the default scripting language for Elasticsearch and
|
|
@ -1,5 +1,5 @@
|
||||||
[[modules-scripting-security]]
|
[[modules-scripting-security]]
|
||||||
=== Scripting and security
|
== Scripting and security
|
||||||
|
|
||||||
While Elasticsearch contributors make every effort to prevent scripts from
|
While Elasticsearch contributors make every effort to prevent scripts from
|
||||||
running amok, security is something best done in
|
running amok, security is something best done in
|
|
@ -1,5 +1,5 @@
|
||||||
[[modules-scripting-using]]
|
[[modules-scripting-using]]
|
||||||
=== How to use scripts
|
== How to use scripts
|
||||||
|
|
||||||
Wherever scripting is supported in the Elasticsearch API, the syntax follows
|
Wherever scripting is supported in the Elasticsearch API, the syntax follows
|
||||||
the same pattern:
|
the same pattern:
|
||||||
|
@ -45,7 +45,7 @@ GET my_index/_search
|
||||||
// CONSOLE
|
// CONSOLE
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
=== Script Parameters
|
=== Script parameters
|
||||||
|
|
||||||
`lang`::
|
`lang`::
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ minute will be compiled. You can change this setting dynamically by setting
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
[[modules-scripting-short-script-form]]
|
[[modules-scripting-short-script-form]]
|
||||||
=== Short Script Form
|
=== Short script form
|
||||||
A short script form can be used for brevity. In the short form, `script` is represented
|
A short script form can be used for brevity. In the short form, `script` is represented
|
||||||
by a string instead of an object. This string contains the source of the script.
|
by a string instead of an object. This string contains the source of the script.
|
||||||
|
|
||||||
|
@ -131,12 +131,13 @@ The same script in the normal form:
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
[[modules-scripting-stored-scripts]]
|
[[modules-scripting-stored-scripts]]
|
||||||
=== Stored Scripts
|
=== Stored scripts
|
||||||
|
|
||||||
Scripts may be stored in and retrieved from the cluster state using the
|
Scripts may be stored in and retrieved from the cluster state using the
|
||||||
`_scripts` end-point.
|
`_scripts` end-point.
|
||||||
|
|
||||||
==== Request Examples
|
[float]
|
||||||
|
==== Request examples
|
||||||
|
|
||||||
The following are examples of using a stored script that lives at
|
The following are examples of using a stored script that lives at
|
||||||
`/_scripts/{id}`.
|
`/_scripts/{id}`.
|
||||||
|
@ -196,7 +197,7 @@ DELETE _scripts/calculate-score
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
[[modules-scripting-using-caching]]
|
[[modules-scripting-using-caching]]
|
||||||
=== Script Caching
|
=== Script caching
|
||||||
|
|
||||||
All scripts are cached by default so that they only need to be recompiled
|
All scripts are cached by default so that they only need to be recompiled
|
||||||
when updates occur. By default, scripts do not have a time-based expiration, but
|
when updates occur. By default, scripts do not have a time-based expiration, but
|
Loading…
Reference in New Issue