Cleanup ScriptType (#21179)

Refactored ScriptType to clean up some of the variable and method names. Added more documentation. Deprecated the 'in' ParseField in favor of 'stored' to match the indexed scripts being replaced by stored scripts.
This commit is contained in:
Jack Conradson 2016-10-31 13:48:51 -07:00 committed by GitHub
parent 344a8028f8
commit 185dff7346
13 changed files with 107 additions and 57 deletions

View file

@ -8,12 +8,12 @@ the same pattern:
-------------------------------------
"script": {
"lang": "...", <1>
"inline" | "id" | "file": "...", <2>
"inline" | "stored" | "file": "...", <2>
"params": { ... } <3>
}
-------------------------------------
<1> The language the script is written in, which defaults to `painless`.
<2> The script itself which may be specified as `inline`, `id`, or `file`.
<2> The script itself which may be specified as `inline`, `stored`, or `file`.
<3> Any named parameters that should be passed into the script.
For example, the following script is used in a search request to return a
@ -211,7 +211,7 @@ GET _scripts/groovy/calculate-score
// CONSOLE
// TEST[continued]
Stored scripts can be used by specifying the `lang` and `id` parameters as follows:
Stored scripts can be used by specifying the `lang` and `stored` parameters as follows:
[source,js]
--------------------------------------------------
@ -221,7 +221,7 @@ GET _search
"script": {
"script": {
"lang": "groovy",
"id": "calculate-score",
"stored": "calculate-score",
"params": {
"my_modifier": 2
}