docs/sources/datasources/elasticsearch/troubleshooting/index.md
This document provides troubleshooting information for common errors you may encounter when using the Elasticsearch data source in Grafana.
The following errors occur when Grafana cannot establish or maintain a connection to Elasticsearch.
Error message: "Health check failed: Failed to connect to Elasticsearch"
Cause: Grafana cannot establish a network connection to the Elasticsearch server.
Solution:
Error message: "Health check failed: Elasticsearch data source is not healthy. Request timed out"
Cause: The connection to Elasticsearch timed out before receiving a response.
Solution:
Error message: "Failed to parse data source URL"
Cause: The URL entered in the data source configuration is not valid.
Solution:
http://localhost:9200 or https://elasticsearch.example.com:9200).http:// or https://).The following errors occur when there are issues with authentication credentials or permissions.
Error message: "Health check failed: Elasticsearch data source is not healthy. Status: 401 Unauthorized"
Cause: The authentication credentials are invalid or missing.
Solution:
Error message: "Health check failed: Elasticsearch data source is not healthy. Status: 403 Forbidden"
Cause: The authenticated user does not have permission to access the requested resource.
Solution:
_cluster/health endpoint.The following errors occur when the Elasticsearch cluster is unhealthy or unavailable.
Error message: "Health check failed: Elasticsearch data source is not healthy"
Cause: The Elasticsearch cluster health status is red, indicating one or more primary shards are not allocated.
Solution:
GET /_cluster/health.GET /_cat/shards?v&h=index,shard,prirep,state,unassigned.reason.Error message: "Health check failed: Elasticsearch data source is not healthy. Status: 502 Bad Gateway"
Cause: A proxy or load balancer between Grafana and Elasticsearch returned an error.
Solution:
The following errors occur when there are issues with the configured index or index pattern.
Error message: "Error validating index: index_not_found"
Cause: The specified index or index pattern does not match any existing indices.
Solution:
GET /_cat/indices.[logs-]YYYY.MM.DD), ensure indices exist for the selected time range.Error message: "Could not find time field '@timestamp' with type date in index"
Cause: The specified time field does not exist in the index or is not of type date.
Solution:
GET /<index>/_mapping.date type, not text or keyword.timestamp instead of @timestamp), update the data source configuration.The following errors occur when there are issues with query syntax or configuration.
Error message: "Trying to create too many buckets. Must be less than or equal to: [65536]."
Cause: The query is generating more aggregation buckets than Elasticsearch allows.
Solution:
10s to 1m).search.max_buckets setting in Elasticsearch (requires cluster admin access).Error message: "Required one of fields [field, script], but none were specified."
Cause: A metric aggregation (such as Average, Sum, or Min) was added without specifying a field.
Solution:
Error message: "unsupported interval '<interval>'"
Cause: The interval specified for the index pattern is not valid.
Solution:
Hourly, Daily, Weekly, Monthly, or Yearly.No pattern and specify the exact index name.The following errors occur when there are Elasticsearch version compatibility issues.
Error message: "Support for Elasticsearch versions after their end-of-life (currently versions < 7.16) was removed. Using unsupported version of Elasticsearch may lead to unexpected and incorrect results."
Cause: The Elasticsearch version is no longer supported by the Grafana data source.
Solution:
The following issues don't produce specific error messages but are commonly encountered.
Cause: The query returns no data.
Solution:
_search API.Cause: Queries take a long time to execute.
Solution:
Cause: Cross-Origin Resource Sharing (CORS) is blocking requests from the browser to Elasticsearch.
Solution:
http.cors.enabled: true
http.cors.allow-origin: '<your-grafana-url>'
http.cors.allow-headers: 'Authorization, Content-Type'
http.cors.allow-credentials: true
{{< admonition type="note" >}} Server (proxy) access mode is recommended for security and reliability. {{< /admonition >}}
If you continue to experience issues after following this troubleshooting guide: