docs/sources/datasources/elasticsearch/annotations/index.md
Annotations overlay event data on your dashboard graphs, helping you correlate log events with metrics. You can use Elasticsearch as a data source for annotations to display events such as deployments, alerts, or other significant occurrences on your visualizations.
For general information about annotations, refer to Annotate visualizations.
Before creating Elasticsearch annotations, ensure you have:
To add an Elasticsearch annotation to your dashboard:
Use the query field to filter which Elasticsearch documents appear as annotations. The query uses Lucene query syntax.
Examples:
| Query | Description |
|---|---|
* | Matches all documents. |
type:deployment | Shows only deployment events. |
level:error OR level:critical | Shows error and critical events. |
service:api AND environment:production | Shows events for a specific service and environment. |
tags:release | Shows events tagged as releases. |
You can use template variables in your annotation queries. For example, service:$service filters annotations based on the selected service variable.
Field mappings tell Grafana which Elasticsearch fields contain the annotation data.
The Time field specifies which field contains the annotation timestamp.
@timestampThe Time End field specifies a field containing the end time for range annotations. Range annotations display as a shaded region on the graph instead of a single vertical line.
The Text field specifies which field contains the annotation description displayed when you hover over the annotation.
tagsmessage, description, or summary.The Tags field specifies which field contains tags for the annotation. Tags help categorize and filter annotations.
To display deployment events as annotations:
type:deployment@timestampmessageenvironmentThis configuration displays deployment events with their messages as the annotation text and environments as tags.
To display incidents with duration:
type:incidentstart_timeend_timedescriptionseverityThis configuration displays incidents as shaded regions from their start time to end time.