sort.asciidoc 958 B

123456789101112131415161718192021222324252627
  1. [[sort-processor]]
  2. === Sort Processor
  3. Sorts the elements of an array ascending or descending. Homogeneous arrays of numbers will be sorted
  4. numerically, while arrays of strings or heterogeneous arrays of strings + numbers will be sorted lexicographically.
  5. Throws an error when the field is not an array.
  6. [[sort-options]]
  7. .Sort Options
  8. [options="header"]
  9. |======
  10. | Name | Required | Default | Description
  11. | `field` | yes | - | The field to be sorted
  12. | `order` | no | `"asc"` | The sort order to use. Accepts `"asc"` or `"desc"`.
  13. | `target_field` | no | `field` | The field to assign the sorted value to, by default `field` is updated in-place
  14. include::common-options.asciidoc[]
  15. |======
  16. [source,js]
  17. --------------------------------------------------
  18. {
  19. "sort": {
  20. "field": "array_field_to_sort",
  21. "order": "desc"
  22. }
  23. }
  24. --------------------------------------------------
  25. // NOTCONSOLE