Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog/136426.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
summary: "Docs: clarify ESQL time span alias rules (month m/mm vs minute min/mi/n), note case-insensitive matching and optional whitespace, and add unambiguous examples."
area: ES|QL
type: docs
issues:
- 135552
pr: 136426
17 changes: 15 additions & 2 deletions docs/reference/query-languages/esql/esql-time-spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,30 @@ POST /_query
```


### Duration units and matching rules

Duration literals can be written with or without a space between the number and the unit
(for example, `1m` is equivalent to `1 m`). Matching is **case-insensitive**.

## Supported temporal units [esql-time-spans-table]

| Temporal Units | Valid Abbreviations |
| --- | --- |
| year | y, yr, years |
| quarter | q, quarters |
| month | mo, months |
| month | m, mm, month, months |
| week | w, weeks |
| day | d, days |
| hour | h, hours |
| minute | min, minutes |
| minute | min, mi, n, minute, minutes |
| second | s, sec, seconds |
| millisecond | ms, milliseconds |

**Examples**

```esql
FROM t | WHERE date_col > NOW() - 1m // month (same as: 1 m)
FROM t | WHERE ts > NOW() - 1mi // minute
FROM t | WHERE ts > NOW() - 1n // minute
FROM t | WHERE ts > NOW() - 500ms // millisecond
```
Loading