sort.asciidoc 1001 B

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