Back to Elasticsearch

Trange

docs/reference/query-languages/esql/_snippets/functions/examples/trange.md

9.4.02.0 KB
Original Source

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

Examples

esql
FROM k8s
| WHERE TRANGE(1h)
| KEEP @timestamp
esql
FROM k8s
| WHERE TRANGE("2024-05-10T00:17:14.000Z", "2024-05-10T00:18:33.000Z")
| SORT @timestamp
| KEEP @timestamp
| LIMIT 10
@timestamp:datetime
2024-05-10T00:17:16.000Z
2024-05-10T00:17:20.000Z
2024-05-10T00:17:30.000Z
2024-05-10T00:17:30.000Z
2024-05-10T00:17:39.000Z
2024-05-10T00:17:39.000Z
2024-05-10T00:17:55.000Z
2024-05-10T00:18:02.000Z
2024-05-10T00:18:02.000Z
2024-05-10T00:18:02.000Z
esql
FROM k8s
| WHERE TRANGE(to_datetime("2024-05-10T00:17:14Z"), to_datetime("2024-05-10T00:18:33Z"))
| SORT @timestamp
| KEEP @timestamp
| LIMIT 10
@timestamp:datetime
2024-05-10T00:17:16.000Z
2024-05-10T00:17:20.000Z
2024-05-10T00:17:30.000Z
2024-05-10T00:17:30.000Z
2024-05-10T00:17:39.000Z
2024-05-10T00:17:39.000Z
2024-05-10T00:17:55.000Z
2024-05-10T00:18:02.000Z
2024-05-10T00:18:02.000Z
2024-05-10T00:18:02.000Z
esql
FROM k8s
| WHERE TRANGE(to_datetime("2024-05-10T00:17:14.000Z"), to_datetime("2024-05-10T00:18:33.000Z"))
| SORT @timestamp
| KEEP @timestamp
| LIMIT 10
@timestamp:datetime
2024-05-10T00:17:16.000Z
2024-05-10T00:17:20.000Z
2024-05-10T00:17:30.000Z
2024-05-10T00:17:30.000Z
2024-05-10T00:17:39.000Z
2024-05-10T00:17:39.000Z
2024-05-10T00:17:55.000Z
2024-05-10T00:18:02.000Z
2024-05-10T00:18:02.000Z
2024-05-10T00:18:02.000Z
esql
FROM k8s
| WHERE TRANGE(1715300236000, 1715300282000)
| SORT @timestamp
| KEEP @timestamp
| LIMIT 10
@timestamp:datetime
2024-05-10T00:17:20.000Z
2024-05-10T00:17:30.000Z
2024-05-10T00:17:30.000Z
2024-05-10T00:17:39.000Z
2024-05-10T00:17:39.000Z
2024-05-10T00:17:55.000Z
2024-05-10T00:18:02.000Z
2024-05-10T00:18:02.000Z
2024-05-10T00:18:02.000Z