ES|QL SPARKLINE function
field- Expression that calculates the y-axis value of the sparkline graph for each datapoint.
key- Date expression from which to derive buckets.
buckets- Target number of buckets, or desired bucket size if
fromandtoparameters are omitted. from- Start of the range. Can be a date or a date expressed as a string.
to-
End of the range. Can be a date or a date expressed as a string.
The values representing the y-axis values of a sparkline graph for a given aggregation over a period of time.
| field | key | buckets | from | to | result |
|---|---|---|---|---|---|
| double | date | integer | text | text | double |
| integer | date | integer | date | date | integer |
| long | date | integer | keyword | keyword | long |
FROM employees
| STATS sparkline = SPARKLINE(COUNT(*), hire_date, 20, "1985-01-01T00:00:00Z", "1985-12-31T00:00:00Z")
| sparkline:long |
|---|
| [0, 2, 0, 0, 1, 0, 1, 0, 1, 2, 4, 0] |