Skip to content

[DOCS] Move 'Scripting' section to top-level navigation. #42939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/reference/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ include::cluster.asciidoc[]

include::query-dsl.asciidoc[]

include::scripting.asciidoc[]

include::mapping.asciidoc[]

include::analysis.asciidoc[]
Expand Down
12 changes: 0 additions & 12 deletions docs/reference/modules.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<<modules-scripting-painless,Painless>>::

A built-in scripting language for Elasticsearch that's designed to be as secure as possible.

<<modules-plugins,Plugins>>::

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>>::

Backup your data with snapshot/restore.
Expand Down Expand Up @@ -102,8 +92,6 @@ include::modules/node.asciidoc[]
:edit_url:
include::modules/plugins.asciidoc[]

include::modules/scripting.asciidoc[]

include::modules/snapshots.asciidoc[]

include::modules/threadpool.asciidoc[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
[[modules-scripting]]
== Scripting
= Scripting

The 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.
[partintro]
--
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`>>.
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.

[float]
=== General-purpose languages:
== General-purpose languages

These languages can be used for any purpose in the scripting APIs,
and give the most flexibility.
Expand All @@ -29,7 +31,7 @@ and give the most flexibility.
|=======================================================================

[float]
=== Special-purpose languages:
== Special-purpose languages

These languages are less flexible, but typically have higher performance for
certain tasks.
Expand Down Expand Up @@ -67,7 +69,7 @@ sandboxed languages can be a security issue, please read
<<modules-scripting-security, Scripting and security>> for more details.

=================================================

--

include::scripting/using.asciidoc[]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[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
be used to write scripts that need to use advanced internals of scripting. For example,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[modules-scripting-expression]]
=== Lucene Expressions Language
== Lucene expressions language

Lucene's expressions compile a `javascript` expression to bytecode. They are
designed for high-performance custom ranking and sorting functions and are
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[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
variables and document fields.
Expand All @@ -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.

[float]
== Search and Aggregation scripts
== Search and aggregation scripts

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
Expand Down Expand Up @@ -80,7 +80,7 @@ GET my_index/_search

[float]
[[modules-scripting-doc-vals]]
=== Doc Values
=== Doc values

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
Expand Down Expand Up @@ -140,7 +140,7 @@ access `text` fields from scripts.

[float]
[[modules-scripting-stored]]
=== Stored Fields and `_source`
=== Stored fields and `_source`

_Stored fields_ -- fields explicitly marked as
<<mapping-store,`"store": true`>> -- can be accessed using the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[modules-scripting-painless]]
=== Painless Scripting Language
== Painless scripting language

_Painless_ is a simple, secure scripting language designed specifically for use
with Elasticsearch. It is the default scripting language for Elasticsearch and
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[modules-scripting-security]]
=== Scripting and security
== Scripting and security

While Elasticsearch contributors make every effort to prevent scripts from
running amok, security is something best done in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[modules-scripting-using]]
=== How to use scripts
== How to use scripts

Wherever scripting is supported in the Elasticsearch API, the syntax follows
the same pattern:
Expand Down Expand Up @@ -45,7 +45,7 @@ GET my_index/_search
// CONSOLE

[float]
=== Script Parameters
=== Script parameters

`lang`::

Expand Down Expand Up @@ -107,7 +107,7 @@ minute will be compiled. You can change this setting dynamically by setting

[float]
[[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
by a string instead of an object. This string contains the source of the script.

Expand All @@ -131,12 +131,13 @@ The same script in the normal form:

[float]
[[modules-scripting-stored-scripts]]
=== Stored Scripts
=== Stored scripts

Scripts may be stored in and retrieved from the cluster state using the
`_scripts` end-point.

==== Request Examples
[float]
==== Request examples

The following are examples of using a stored script that lives at
`/_scripts/{id}`.
Expand Down Expand Up @@ -196,7 +197,7 @@ DELETE _scripts/calculate-score

[float]
[[modules-scripting-using-caching]]
=== Script Caching
=== Script caching

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
Expand Down