Loading

ES|QL LATEST function

Embedded
field

The search field

An alias for LAST where the sort field (the second parameter) is implicit and is set to @timestamp.

field result
boolean boolean
date date
date_nanos date_nanos
double double
integer integer
ip ip
keyword keyword
long long
text keyword
        @timestamp        |  name   | number
"2025-11-25T00:00:00.000Z | alpha   | 1"
"2025-11-25T00:00:01.000Z | alpha   | 2"
"2025-11-25T00:00:02.000Z | bravo   | null"
"2025-11-25T00:00:03.000Z | alpha   | 4"
"2025-11-25T00:00:04.000Z | bravo   | 5"
"2025-11-25T00:00:05.000Z | charlie | [6, 7, 8]"
"2025-11-25T00:00:06.000Z | delta   | null"

From dataset
| STATS last_val = LATEST(number) BY name
		
last_val:long name:keyword
4 alpha
5 bravo
[6, 7, 8] charlie
null delta