﻿---
title: ES|QL EARLIEST function
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/aggregation-functions/earliest
products:
  - Elasticsearch
---

# ES|QL EARLIEST function
<applies-to>
  - Elastic Stack: Generally available since 9.4
</applies-to>


## Syntax

![Embedded](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/images/generated/x-pack-esql/functions/earliest.svg)


## Parameters

<definitions>
  <definition term="field">
    The search field
  </definition>
</definitions>


## Description

An alias for [`FIRST`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/aggregation-functions/first) where the sort field (the second parameter) is implicit and is set to `@timestamp`.

## Supported types


| field                                                                 | result                |
|-----------------------------------------------------------------------|-----------------------|
| boolean                                                               | boolean               |
| cartesian_point <applies-to>Elastic Stack: Planned</applies-to>       | cartesian_point       |
| cartesian_shape <applies-to>Elastic Stack: Planned</applies-to>       | cartesian_shape       |
| date                                                                  | date                  |
| date_nanos                                                            | date_nanos            |
| dense_vector <applies-to>Elastic Stack: Planned</applies-to>          | dense_vector          |
| double                                                                | double                |
| exponential_histogram <applies-to>Elastic Stack: Planned</applies-to> | exponential_histogram |
| geo_point <applies-to>Elastic Stack: Planned</applies-to>             | geo_point             |
| geo_shape <applies-to>Elastic Stack: Planned</applies-to>             | geo_shape             |
| geohash <applies-to>Elastic Stack: Planned</applies-to>               | geohash               |
| geohex <applies-to>Elastic Stack: Planned</applies-to>                | geohex                |
| geotile <applies-to>Elastic Stack: Planned</applies-to>               | geotile               |
| integer                                                               | integer               |
| ip                                                                    | ip                    |
| keyword                                                               | keyword               |
| long                                                                  | long                  |
| tdigest <applies-to>Elastic Stack: Planned</applies-to>               | tdigest               |
| text                                                                  | keyword               |
| unsigned_long <applies-to>Elastic Stack: Planned</applies-to>         | unsigned_long         |
| version <applies-to>Elastic Stack: Planned</applies-to>               | version               |


## Example

```esql
        @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 value = EARLIEST(number)
```


| value:long |
|------------|
| 1          |