scripting.asciidoc 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. [float]
  2. [[breaking_70_scripting_changes]]
  3. === Scripting changes
  4. [float]
  5. ==== getDate() and getDates() removed
  6. Fields of type `long` and `date` had `getDate()` and `getDates()` methods
  7. (for multi valued fields) to get an object with date specific helper methods
  8. for the current doc value. In 5.3.0, `date` fields were changed to expose
  9. this same date object directly when calling `doc["myfield"].value`, and
  10. the getter methods for date objects were deprecated. These methods have
  11. now been removed. Instead, use `.value` on `date` fields, or explicitly
  12. parse `long` fields into a date object using
  13. `Instance.ofEpochMillis(doc["myfield"].value)`.
  14. [float]
  15. ==== Accessing missing document values will throw an error
  16. `doc['field'].value` will throw an exception if
  17. the document is missing a value for the field `field`.
  18. To check if a document is missing a value, you can use
  19. `doc['field'].size() == 0`.
  20. [float]
  21. ==== Script errors will return as `400` error codes
  22. Malformed scripts, either in search templates, ingest pipelines or search
  23. requests, return `400 - Bad request` while they would previously return
  24. `500 - Internal Server Error`. This also applies for stored scripts.