elasticsearch/docs/reference/migration/migrate_8_0/scripting.asciidoc
Jack Conradson 2cf160f2c0
Remove deprecated code from stored scripts (#78643)
This change removes several pieces of deprecated code from stored scripts.

Stored scripts/templates are no longer allowed to be an empty and will throw an exception when used 
with PutStoredScript.

ScriptMetadata will now drop any existing stored scripts that are empty with a deprecation warning in 
the case they have not been previously removed.

The code field is now only allowed as source as part of a PutStoredScript JSON blob.
2021-10-05 10:41:39 -07:00

52 lines
No EOL
1.8 KiB
Text

[discrete]
[[breaking_80_scripting_changes]]
==== Scripting changes
//NOTE: The notable-breaking-changes tagged regions are re-used in the
//Installation and Upgrade Guide
//tag::notable-breaking-changes[]
.The `JodaCompatibleDateTime` class has been removed.
[%collapsible]
====
*Details* +
As a transition from Joda datetime to Java datetime, scripting used
an intermediate class called `JodaCompatibleDateTime`. This class has
been removed and is replaced by `ZonedDateTime`. Any use of casting
to a `JodaCompatibleDateTime` in a script will result in a compilation
error, and may not allow the upgraded node to start.
*Impact* +
Before upgrading, replace `getDayOfWeek` with `getDayOfWeekEnum().value` in any
scripts. Any use of `getDayOfWeek` expecting a return value of `int` will result
in a compilation error or runtime error and may not allow the upgraded node to
start.
====
.Stored scripts no longer support empty scripts or search templates.
[%collapsible]
====
*Details* +
The {ref}/create-stored-script-api.html[create or update stored script API]'s
`source` parameter cannot be empty.
*Impact* +
Before upgrading, use the {ref}/delete-stored-script-api.html[delete stored
script API] to delete any empty stored scripts or search templates.
In 8.0, {es} will drop any empty stored scripts or empty search templates from
the cluster state. Requests to create a stored script or search template with
an empty `source` will return an error.
====
.The create or update stored script API's `code` parameter has been removed.
[%collapsible]
====
*Details* +
The {ref}/create-stored-script-api.html[create or update stored script API]'s
`code` parameter has been removed. Use the `source` parameter instead.
*Impact* +
Discontinue use of the `code` parameter. Requests that include the parameter
will return an error.
====
// end::notable-breaking-changes[]