ES|QL RANGE_INTERSECTS function
Returns true if two date ranges or dates overlap.
left- First value (point or range).
right-
Second value (point or range).
Returns true if the two arguments overlap. The relation is symmetric — argument order does not matter. Supports any combination of date and date_range. When both arguments are date, this is equivalent to a == b.
| left | right | result |
|---|---|---|
| date | date | boolean |
| date | date_range
|
boolean |
| date_range
|
date | boolean |
| date_range
|
date_range
|
boolean |
FROM employees
| WHERE RANGE_INTERSECTS(hire_date, TO_DATE_RANGE("1985-02-01..1985-03-01"))
| KEEP emp_no, hire_date
| SORT emp_no
| emp_no:integer | hire_date:date |
|---|---|
| 10009 | 1985-02-18T00:00:00.000Z |
| 10048 | 1985-02-24T00:00:00.000Z |
Find ranges that overlap a target window