Type to search.

ES|QL SPARKLINE function

Serverless Preview

Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud.

Availability

  • Preview

    This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply.

Serverless interfaces and procedures might differ from classic Elastic Stack deployments.

Stack Preview 9.5+

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Preview since 9.5

    This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply.

Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Computes y-axis values of a sparkline graph for an aggregation over time.

Embedded
Embedded
aggregation
Aggregation 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.
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.

aggregation key buckets from to result
double date integer date date double
double date integer date keyword double
double date integer date text double
double date integer keyword date double
double date integer keyword keyword double
double date integer keyword text double
double date integer text date double
double date integer text keyword double
double date integer text text double
integer date integer date date integer
integer date integer date keyword integer
integer date integer date text integer
integer date integer keyword date integer
integer date integer keyword keyword integer
integer date integer keyword text integer
integer date integer text date integer
integer date integer text keyword integer
integer date integer text text integer
long date integer date date long
long date integer date keyword long
long date integer date text long
long date integer keyword date long
long date integer keyword keyword long
long date integer keyword text long
long date integer text date long
long date integer text keyword long
long date integer text text long
ES|QL
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]