Update docs about script parameter (#27010)

Added a description of short script form. Also removed references to the obsolete `script.default_lang`.
This commit is contained in:
Anton Pozhidaev 2017-10-16 15:04:43 +03:00 committed by Ryan Ernst
parent 8dda827ff4
commit 70668dddf3
2 changed files with 27 additions and 6 deletions

View File

@ -98,8 +98,8 @@ parameter in the same way as the search api.
So far we've only been updating documents without changing their source. That
is genuinely useful for things like
<<picking-up-a-new-property,picking up new properties>> but it's only half the
fun. `_update_by_query` supports a `script` object to update the document. This
will increment the `likes` field on all of kimchy's tweets:
fun. `_update_by_query` <<modules-scripting-using,supports scripts>> to update
the document. This will increment the `likes` field on all of kimchy's tweets:
[source,js]
--------------------------------------------------

View File

@ -49,10 +49,7 @@ GET my_index/_search
`lang`::
Specifies the language the script is written in. Defaults to `painless` but
may be set to any of languages listed in <<modules-scripting>>. The
default language may be changed in the `elasticsearch.yml` config file by
setting `script.default_lang` to the appropriate language.
Specifies the language the script is written in. Defaults to `painless`.
`source`, `id`::
@ -108,6 +105,30 @@ minute will be compiled. You can change this setting dynamically by setting
========================================
[float]
[[modules-scripting-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.
Short form:
[source,js]
----------------------
"script": "ctx._source.likes++"
----------------------
// NOTCONSOLE
The same script in the normal form:
[source,js]
----------------------
"script": {
"source": "ctx._source.likes++"
}
----------------------
// NOTCONSOLE
[float]
[[modules-scripting-stored-scripts]]
=== Stored Scripts