12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- [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 `JodaCompatibleZonedDateTime` class has been removed.
- [%collapsible]
- ====
- *Details* +
- As a transition from Joda datetime to Java datetime, scripting used
- an intermediate class called `JodaCompatibleZonedDateTime`. This class
- has been removed and is replaced by `ZonedDateTime`. Any use of casting
- to a `JodaCompatibleZonedDateTime` or use of method calls only available
- in `JodaCompatibleZonedDateTime` 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.
- The following `JodaCompatibleZonedDateTime` methods must be replaced using
- `ZonedDateTime` methods prior to upgrade:
- * `getMillis()` -> `toInstant().toEpochMilli()`
- * `getCenturyOfEra()` -> `get(ChronoField.YEAR_OF_ERA) / 100`
- * `getEra()` -> `get(ChronoField.ERA)`
- * `getHourOfDay()` -> `getHour()`
- * `getMillisOfDay()` -> `get(ChronoField.MILLI_OF_DAY)`
- * `getMillisOfSecond()` -> `get(ChronoField.MILLI_OF_SECOND)`
- * `getMinuteOfDay()` -> `get(ChronoField.MINUTE_OF_DAY)`
- * `getMinuteOfHour()` -> `getMinute()`
- * `getMonthOfYear()` -> `getMonthValue()`
- * `getSecondOfDay()` -> `get(ChronoField.SECOND_OF_DAY)`
- * `getSecondOfMinute()` -> `getSecond()`
- * `getWeekOfWeekyear()` -> `get(DateFormatters.WEEK_FIELDS_ROOT.weekBasedYear())`
- * `getYearOfCentury()` -> `get(ChronoField.YEAR_OF_ERA) % 100`
- * `getYearOfEra()` -> `get(ChronoField.YEAR_OF_ERA)`
- * `toString(String)` -> a DateTimeFormatter
- * `toString(String, Locale)` -> a DateTimeFormatter
- ====
- .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[]
|