2022-11-01 23:22:06 +08:00
---
aliases:
2022-12-10 00:36:04 +08:00
- ../data-sources/elasticsearch/
- ../features/datasources/elasticsearch/
2022-11-01 23:22:06 +08:00
description: Guide for using Elasticsearch in Grafana
keywords:
- grafana
- elasticsearch
- guide
2023-09-02 02:18:36 +08:00
- data source
Explicitly set all front matter labels in the source files (#71548)
* Set every page to have defaults of 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration pages to have of 'Cloud', 'Enterprise', and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/enterprise-licensing pages to have 'Enterprise' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/organization-management pages to have 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/provisioning pages to have 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/recorded-queries pages to have labels cloud,enterprise
* Set administration/roles-and-permissions/access-control pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/stats-and-license pages to have labels cloud,enterprise
* Set alerting pages to have labels cloud,enterprise,oss
* Set breaking-changes pages to have labels cloud,enterprise,oss
* Set dashboards pages to have labels cloud,enterprise,oss
* Set datasources pages to have labels cloud,enterprise,oss
* Set explore pages to have labels cloud,enterprise,oss
* Set fundamentals pages to have labels cloud,enterprise,oss
* Set introduction/grafana-cloud pages to have labels cloud
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Fix introduction pages products
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set panels-visualizations pages to have labels cloud,enterprise,oss
* Set release-notes pages to have labels cloud,enterprise,oss
* Set search pages to have labels cloud,enterprise,oss
* Set setup-grafana/configure-security/audit-grafana pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/configure-authentication pages to have labels cloud,enterprise,oss
* Set setup-grafana/configure-security/configure-authentication/enhanced-ldap pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-authentication/saml pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-database-encryption/encrypt-secrets-using-hashicorp-key-vault pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-request-security pages to have labels cloud,enterprise,oss
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/configure-team-sync pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/export-logs pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set troubleshooting pages to have labels cloud,enterprise,oss
* Set whatsnew pages to have labels cloud,enterprise,oss
* Apply updated labels from review
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
---------
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
2023-07-18 16:10:12 +08:00
labels:
products:
- cloud
- enterprise
- oss
2022-11-01 23:22:06 +08:00
menuTitle: Elasticsearch
title: Elasticsearch data source
weight: 325
2024-05-28 22:17:49 +08:00
refs:
configuration:
- pattern: /docs/grafana/
destination: /docs/grafana/< GRAFANA_VERSION > /setup-grafana/configure-grafana/#sigv4_auth_enabled
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/< GRAFANA_VERSION > /setup-grafana/configure-grafana/#sigv4_auth_enabled
provisioning-grafana:
- pattern: /docs/grafana/
destination: /docs/grafana/< GRAFANA_VERSION > /administration/provisioning/#data-sources
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/< GRAFANA_VERSION > /administration/provisioning/#data-sources
explore:
- pattern: /docs/grafana/
destination: /docs/grafana/< GRAFANA_VERSION > /explore/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/< GRAFANA_VERSION > /explore/
build-dashboards:
- pattern: /docs/grafana/
destination: /docs/grafana/< GRAFANA_VERSION > /dashboards/build-dashboards/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/< GRAFANA_VERSION > /dashboards/build-dashboards/
2022-11-01 23:22:06 +08:00
---
# Elasticsearch data source
2023-09-02 02:18:36 +08:00
Elasticsearch is a search and analytics engine used for a variety of use cases.
You can create many types of queries to visualize logs or metrics stored in Elasticsearch, and annotate graphs with log events stored in Elasticsearch.
2022-11-01 23:22:06 +08:00
2023-09-02 02:18:36 +08:00
The following will help you get started working with Elasticsearch and Grafana:
2022-11-01 23:22:06 +08:00
2023-09-02 02:18:36 +08:00
- [What is Elasticsearch? ](https://www.elastic.co/guide/en/elasticsearch/reference/current/elasticsearch-intro.html )
- [Configure the Elasticsearch data source ](/docs/grafana/latest/datasources/elasticsearch/configure-elasticsearch-data-source/ )
2025-03-06 20:59:08 +08:00
- [Elasticsearch query editor ](query-editor/ )
- [Elasticsearch template variables ](template-variables/ )
2022-11-01 23:22:06 +08:00
## Supported Elasticsearch versions
This data source supports these versions of Elasticsearch:
2024-03-13 18:25:28 +08:00
- v7.17+
2023-01-16 23:54:40 +08:00
- v8.x
2022-11-01 23:22:06 +08:00
2023-05-30 17:05:50 +08:00
Our maintenance policy for Elasticsearch data source is aligned with the [Elastic Product End of Life Dates ](https://www.elastic.co/support/eol ) and we ensure proper functionality for supported versions. If you are using an Elasticsearch with version that is past its end-of-life (EOL), you can still execute queries, but you will receive a notification in the query builder indicating that the version of Elasticsearch you are using is no longer supported. It's important to note that in such cases, we do not guarantee the correctness of the functionality, and we will not be addressing any related issues.
2023-09-02 02:18:36 +08:00
## Provision the data source
2022-11-01 23:22:06 +08:00
You can define and configure the data source in YAML files as part of Grafana's provisioning system.
2024-05-28 22:17:49 +08:00
For more information about provisioning, and for available configuration options, refer to [Provisioning Grafana ](ref:provisioning-grafana ).
2022-11-01 23:22:06 +08:00
2025-06-20 00:31:13 +08:00
{{< admonition type = "note" > }}
2023-05-23 04:45:28 +08:00
The previously used `database` field has now been [deprecated ](https://github.com/grafana/grafana/pull/58647 ).
You should now use the `index` field in `jsonData` to store the index name.
Please see the examples below.
2025-06-20 00:31:13 +08:00
{{< / admonition > }}
2023-04-19 21:13:53 +08:00
2023-09-02 02:18:36 +08:00
### Provisioning examples
2022-11-01 23:22:06 +08:00
2023-09-02 02:18:36 +08:00
**Basic provisioning**
2022-11-01 23:22:06 +08:00
```yaml
apiVersion: 1
datasources:
- name: Elastic
type: elasticsearch
access: proxy
url: http://localhost:9200
jsonData:
2023-04-19 21:13:53 +08:00
index: '[metrics-]YYYY.MM.DD'
2022-11-01 23:22:06 +08:00
interval: Daily
timeField: '@timestamp'
```
2023-09-02 02:18:36 +08:00
**Provision for logs**
2022-11-01 23:22:06 +08:00
```yaml
apiVersion: 1
datasources:
- name: elasticsearch-v7-filebeat
type: elasticsearch
access: proxy
url: http://localhost:9200
jsonData:
2023-04-19 21:13:53 +08:00
index: '[filebeat-]YYYY.MM.DD'
2022-11-01 23:22:06 +08:00
interval: Daily
timeField: '@timestamp'
logMessageField: message
logLevelField: fields.level
dataLinks:
- datasourceUid: my_jaeger_uid # Target UID needs to be known
field: traceID
url: '$${__value.raw}' # Careful about the double "$$" because of env var expansion
```
2023-09-02 02:18:36 +08:00
## Configure Amazon Elasticsearch Service
If you use Amazon Elasticsearch Service, you can use Grafana's Elasticsearch data source to visualize data from it.
If you use an AWS Identity and Access Management (IAM) policy to control access to your Amazon Elasticsearch Service domain, you must use AWS Signature Version 4 (AWS SigV4) to sign all requests to that domain.
For details on AWS SigV4, refer to the [AWS documentation ](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html ).
### AWS Signature Version 4 authentication
2024-05-28 22:17:49 +08:00
To sign requests to your Amazon Elasticsearch Service domain, you can enable SigV4 in Grafana's [configuration ](ref:configuration ).
2023-09-02 02:18:36 +08:00
Once AWS SigV4 is enabled, you can configure it on the Elasticsearch data source configuration page.
2025-03-06 20:59:08 +08:00
For more information about AWS authentication options, refer to [AWS authentication ](../aws-cloudwatch/aws-authentication/ ).
2023-09-02 02:18:36 +08:00
{{< figure src = "/static/img/docs/v73/elasticsearch-sigv4-config-editor.png" max-width = "500px" class = "docs-image--no-shadow" caption = "SigV4 configuration for AWS Elasticsearch Service" > }}
2022-11-01 23:22:06 +08:00
## Query the data source
You can select multiple metrics and group by multiple terms or filters when using the Elasticsearch query editor.
2025-03-06 20:59:08 +08:00
For details, see the [query editor documentation ](query-editor/ ).
2022-11-01 23:22:06 +08:00
## Use template variables
Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables.
Grafana lists these variables in dropdown select boxes at the top of the dashboard to help you change the data displayed in your dashboard.
Grafana refers to such variables as template variables.
2025-03-06 20:59:08 +08:00
For details, see the [template variables documentation ](template-variables/ ).