Loading

ES|QL TO_RANGE function

Constructs a range from two boundary values.

Embedded
from
Inclusive lower bound of the range ([from, to)). If null, the function returns null.
to

Exclusive upper bound of the range ([from, to)). If null, the function returns null.

Constructs a range from two boundary values. The first argument is the inclusive lower bound; the second is the exclusive upper bound, following the half-open [from, to) convention used for all range types in ES|QL. Currently accepts datetime arguments and returns a date_range.

from to result
date date date_range
ROW from_dt = TO_DATETIME("2000-01-01T00:00:00.000Z"), to_dt = TO_DATETIME("2010-01-01T00:00:00.000Z")
| EVAL r = TO_RANGE(from_dt, to_dt)
| KEEP r
		
r:date_range
2000-01-01..2010-01-01