scripting.asciidoc 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. [discrete]
  2. [[breaking_80_scripting_changes]]
  3. ==== Scripting changes
  4. //NOTE: The notable-breaking-changes tagged regions are re-used in the
  5. //Installation and Upgrade Guide
  6. //tag::notable-breaking-changes[]
  7. .The `JodaCompatibleZonedDateTime` class has been removed.
  8. [%collapsible]
  9. ====
  10. *Details* +
  11. As a transition from Joda datetime to Java datetime, scripting used
  12. an intermediate class called `JodaCompatibleZonedDateTime`. This class
  13. has been removed and is replaced by `ZonedDateTime`. Any use of casting
  14. to a `JodaCompatibleZonedDateTime` or use of method calls only available
  15. in `JodaCompatibleZonedDateTime` in a script will result in a compilation
  16. error, and may not allow the upgraded node to start.
  17. *Impact* +
  18. Before upgrading, replace `getDayOfWeek` with `getDayOfWeekEnum().value` in any
  19. scripts. Any use of `getDayOfWeek` expecting a return value of `int` will result
  20. in a compilation error or runtime error and may not allow the upgraded node to
  21. start.
  22. The following `JodaCompatibleZonedDateTime` methods must be replaced using
  23. `ZonedDateTime` methods prior to upgrade:
  24. * `getMillis()` -> `toInstant().toEpochMilli()`
  25. * `getCenturyOfEra()` -> `get(ChronoField.YEAR_OF_ERA) / 100`
  26. * `getEra()` -> `get(ChronoField.ERA)`
  27. * `getHourOfDay()` -> `getHour()`
  28. * `getMillisOfDay()` -> `get(ChronoField.MILLI_OF_DAY)`
  29. * `getMillisOfSecond()` -> `get(ChronoField.MILLI_OF_SECOND)`
  30. * `getMinuteOfDay()` -> `get(ChronoField.MINUTE_OF_DAY)`
  31. * `getMinuteOfHour()` -> `getMinute()`
  32. * `getMonthOfYear()` -> `getMonthValue()`
  33. * `getSecondOfDay()` -> `get(ChronoField.SECOND_OF_DAY)`
  34. * `getSecondOfMinute()` -> `getSecond()`
  35. * `getWeekOfWeekyear()` -> `get(DateFormatters.WEEK_FIELDS_ROOT.weekBasedYear())`
  36. * `getYearOfCentury()` -> `get(ChronoField.YEAR_OF_ERA) % 100`
  37. * `getYearOfEra()` -> `get(ChronoField.YEAR_OF_ERA)`
  38. * `toString(String)` -> a DateTimeFormatter
  39. * `toString(String, Locale)` -> a DateTimeFormatter
  40. ====
  41. .Stored scripts no longer support empty scripts or search templates.
  42. [%collapsible]
  43. ====
  44. *Details* +
  45. The {ref}/create-stored-script-api.html[create or update stored script API]'s
  46. `source` parameter cannot be empty.
  47. *Impact* +
  48. Before upgrading, use the {ref}/delete-stored-script-api.html[delete stored
  49. script API] to delete any empty stored scripts or search templates.
  50. In 8.0, {es} will drop any empty stored scripts or empty search templates from
  51. the cluster state. Requests to create a stored script or search template with
  52. an empty `source` will return an error.
  53. ====
  54. .The create or update stored script API's `code` parameter has been removed.
  55. [%collapsible]
  56. ====
  57. *Details* +
  58. The {ref}/create-stored-script-api.html[create or update stored script API]'s
  59. `code` parameter has been removed. Use the `source` parameter instead.
  60. *Impact* +
  61. Discontinue use of the `code` parameter. Requests that include the parameter
  62. will return an error.
  63. ====
  64. // end::notable-breaking-changes[]