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

# ES|QL EARLIEST function
<applies-to>
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Planned
</applies-to>


## Syntax

![Embedded](https://www.elastic.co/elastic/docs-builder/docs/3031/reference/query-languages/esql/images/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/3031/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    |
| date       | date       |
| date_nanos | date_nanos |
| double     | double     |
| integer    | integer    |
| ip         | ip         |
| keyword    | keyword    |
| long       | long       |
| text       | keyword    |


## 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          |