Back to Elasticsearch

Last

docs/reference/query-languages/esql/_snippets/functions/description/last.md

9.4.0570 B
Original Source

% This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.

Description

This function calculates the latest occurrence of the search field (the first parameter), where sorting order is determined by the sort field (the second parameter). This sorting order is always ascending and null values always sort last. Both fields support null, single-valued, and multi-valued input. If the latest sort field value appears in multiple documents, this function is allowed to return any corresponding search field value.