OpenSearch/docs/reference/modules/scripting
Jack Conradson 3d2626c4c6 Change Namespace for Stored Script to Only Use Id (#22206)
Currently, stored scripts use a namespace of (lang, id) to be put, get, deleted, and executed. This is not necessary since the lang is stored with the stored script. A user should only have to specify an id to use a stored script. This change makes that possible while keeping backwards compatibility with the previous namespace of (lang, id). Anywhere the previous namespace is used will log deprecation warnings.

The new behavior is the following:

When a user specifies a stored script, that script will be stored under both the new namespace and old namespace.

Take for example script 'A' with lang 'L0' and data 'D0'. If we add script 'A' to the empty set, the scripts map will be ["A" -- D0, "A#L0" -- D0]. If a script 'A' with lang 'L1' and data 'D1' is then added, the scripts map will be ["A" -- D1, "A#L1" -- D1, "A#L0" -- D0].

When a user deletes a stored script, that script will be deleted from both the new namespace (if it exists) and the old namespace.

Take for example a scripts map with {"A" -- D1, "A#L1" -- D1, "A#L0" -- D0}. If a script is removed specified by an id 'A' and lang null then the scripts map will be {"A#L0" -- D0}. To remove the final script, the deprecated namespace must be used, so an id 'A' and lang 'L0' would need to be specified.

When a user gets/executes a stored script, if the new namespace is used then the script will be retrieved/executed using only 'id', and if the old namespace is used then the script will be retrieved/executed using 'id' and 'lang'
2017-01-31 13:27:02 -08:00
..
advanced-scripting.asciidoc Reorganise scripting docs (#18132) 2016-05-04 18:17:10 +02:00
expression.asciidoc improve date api for expressions/painless fields 2016-05-31 09:32:33 -04:00
fields.asciidoc Remove groovy scripting language (#21607) 2016-11-22 19:24:12 -08:00
native.asciidoc Docs fix native script usage in 5.x (#22362) 2016-12-29 09:41:26 -08:00
painless-debugging.asciidoc Generate reference links for painless API (#22775) 2017-01-26 10:39:19 -05:00
painless-syntax.asciidoc Update painless-syntax.asciidoc 2016-12-19 10:09:24 +01:00
painless.asciidoc Generate reference links for painless API (#22775) 2017-01-26 10:39:19 -05:00
security.asciidoc Descriptions for scripting enabled (#22388) 2016-12-30 12:50:17 -05:00
using.asciidoc Change Namespace for Stored Script to Only Use Id (#22206) 2017-01-31 13:27:02 -08:00