| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 | === Scripting changes==== Scripting syntaxThe syntax for scripts has been made consistent across all APIs. The acceptedformat is as follows:Inline/Dynamic scripts::+--[source,js]---------------"script": {  "inline": "doc['foo'].value + val", <1>  "lang":   "groovy", <2>  "params": { "val": 3 } <3>}---------------<1> The inline script to execute.<2> The optional language of the script.<3> Any named parameters.--Indexed scripts::+--[source,js]---------------"script": {  "id":     "my_script_id", <1>  "lang":   "groovy", <2>  "params": { "val": 3 } <3>}---------------<1> The ID of the indexed script.<2> The optional language of the script.<3> Any named parameters.--File scripts::+--[source,js]---------------"script": {  "file":   "my_file", <1>  "lang":   "groovy", <2>  "params": { "val": 3 } <3>}---------------<1> The filename of the script, without the `.lang` suffix.<2> The optional language of the script.<3> Any named parameters.--For example, an update request might look like this:[source,js]---------------POST my_index/my_type/1/_update{  "script": {    "inline": "ctx._source.count += val",    "params": { "val": 3 }  },  "upsert": {    "count": 0  }}---------------A short syntax exists for running inline scripts in the default scriptinglanguage without any parameters:[source,js]----------------GET _search{  "script_fields": {    "concat_fields": {      "script": "doc['one'].value + ' ' + doc['two'].value"    }  }}----------------==== Scripting settingsThe `script.disable_dynamic` node setting has been replaced by fine-grainedscript settings described in <<migration-script-settings>>.==== Groovy scripts sandboxThe Groovy sandbox and related settings have been removed. Groovy is now anon-sandboxed scripting language, without any option to turn the sandbox on.==== Plugins making use of scriptsPlugins that make use of scripts must register their own script contextthrough `ScriptModule`. Script contexts can be used as part of fine-grainedsettings to enable/disable scripts selectively.
 |