I figured it out.

First, you need to go to Data Sources in Grafana, and choose Elasticsearch.

You put your index name here. And most importantly, you need a field that can tell time. I used date field. I made a simple sample data like the below. (Look at the date field.)

Go to Grafana dashboard. And in the query, you will see that Date Histogram will be automatically set to date. Choose the metric that you want.

You will see something like this on your graph.

I know my data, field, and so on is not ideal graph material. But I focused on how, not what. Please think of this as 'hello world' for Elastic and Grafana. Hope this helps someone and save their time and energy.

Answer from Jin Lee on Stack Overflow
🌐
Grafana
grafana.com › docs › grafana › latest › datasources › elasticsearch › query-editor
Elasticsearch query editor | Grafana documentation
There are two types of queries you can create with the Elasticsearch query builder. Each type is explained in detail below. Use the Preserve query toggle to keep your Lucene query when you switch between Metrics, Logs, Raw Data, and Raw Document. When the toggle is off (the default for new queries), switching query types clears the Lucene query. Grafana remembers your last Preserve query choice in the browser for new queries.
🌐
Grafana
grafana.com › docs › grafana › latest › datasources › elasticsearch
Elasticsearch data source | Grafana documentation
Grafana ships with the Elasticsearch data source preinstalled, so you can query and visualize logs or metrics stored in Elasticsearch, and annotate graphs with log events, without installing a plugin.
Discussions

Basic Elastic Search Query
Hi Team, Here are my elastic search get results. Can u help me to plot a time series graph with lucene query on grafana? I have the data source configured. {“took”:3,“timed_out”:false,"_shards":{“total”:5,“successful”:5,“failed”:0},“hits”:{“total”:4,“max_score... More on community.grafana.com
🌐 community.grafana.com
1
0
June 26, 2017
Query Elasticsearch from Grafana
Hello, I am trying to visualize some data in Grafana that I get from Elasicsearch. I was able to add the data source and I am able to visualize simple things like the count time series for an index. What I am not able to do is: Group by successfully. I am trying to group by with “Terms” ... More on community.grafana.com
🌐 community.grafana.com
3
1
May 14, 2020
Elasticsearch Query in Grafana
Environment: Grafana 8, elasticsearch 7.14 I have a dashboard where I have variables for Terminal, Maturity (UAT,PROD) and server as below The user can then select the terminal and maturity to display metrics for. I am using jolokia and metric beat to send JMX and system metrics to elasticsearch I can query ... More on community.grafana.com
🌐 community.grafana.com
1
1
August 19, 2021
How to query Elasticsearch datasource in Grafana? - Elasticsearch - Discuss the Elastic Stack
I want to use an index in Elasticsearch as a data source in Grafana. But I can't query it and extract a specific field from it. I want to have only the data of the fields I want as output from among several fields in this data source, like an RDBMs where columns can be selected. in elasticsearch, ... More on discuss.elastic.co
🌐 discuss.elastic.co
0
August 12, 2023
People also ask

Can Grafana connect directly to Elasticsearch?
Yes. Grafana supports Elasticsearch as a native data source, enabling users to visualize and monitor data directly.
🌐
metricfire.com
metricfire.com › blog › using grafana with elasticsearch (tutorial)
Using Grafana with Elasticsearch: Complete Tutorial | MetricFire ...
How do I connect Elasticsearch to Grafana using Docker?
Run both Grafana and Elasticsearch containers in the same Docker network and use 'http://elasticsearch:9200' as the data source URL.
🌐
metricfire.com
metricfire.com › blog › using grafana with elasticsearch (tutorial)
Using Grafana with Elasticsearch: Complete Tutorial | MetricFire ...
What is Elasticsearch used for?
Elasticsearch is an open-source search and analytics engine that indexes structured and unstructured data for fast search and aggregation.
🌐
metricfire.com
metricfire.com › blog › using grafana with elasticsearch (tutorial)
Using Grafana with Elasticsearch: Complete Tutorial | MetricFire ...
🌐
Grafana
community.grafana.com › elasticsearch
Query Elasticsearch from Grafana - Elasticsearch - Grafana Labs Community Forums
May 14, 2020 - Hello, I am trying to visualize some data in Grafana that I get from Elasicsearch. I was able to add the data source and I am able to visualize simple things like the count time series for an index. What I am not able to do is: Group by successfully. I am trying to group by with “Terms” and selecting a keyword field (a keyword text field with name structure .keyword).
🌐
MetricFire
metricfire.com › blog › using grafana with elasticsearch (tutorial)
Using Grafana with Elasticsearch: Complete Tutorial | MetricFire | MetricFire
March 10, 2026 - A: Yes. Grafana supports Elasticsearch as a native data source, allowing you to query, visualize, and monitor your Elasticsearch indices in real time.
Find elsewhere
🌐
Grafana
community.grafana.com › t › elasticsearch-query-in-grafana › 52102
Elasticsearch Query in Grafana - Grafana - Grafana Labs Community Forums
August 19, 2021 - Environment: Grafana 8, elasticsearch 7.14 I have a dashboard where I have variables for Terminal, Maturity (UAT,PROD) and server as below The user can then select the terminal and maturity to display metrics for. I am using jolokia and metric beat to send JMX and system metrics to elasticsearch I can query using elastichead and see the data I need to dashboard based on the same filters the dashboard appears to be using BUT when I have the following query I see data (servers) for mul...
🌐
Elastic
discuss.elastic.co › elastic stack › elasticsearch
How to query Elasticsearch datasource in Grafana? - Elasticsearch - Discuss the Elastic Stack
August 12, 2023 - I want to have only the data of ... where columns can be selected. in elasticsearch, By default, a GET request will return the whole document, as stored in the _source field....
🌐
Grafana
grafana.com › docs › learning-paths › elasticsearch-data-source › business-value
When to query Elasticsearch directly | Grafana Labs
The Elasticsearch data source in Grafana lets you query your existing Elasticsearch instance directly — your data stays where it is while Grafana provides the visualization, exploration, and alerting layer on top.
🌐
Grafana
grafana.com › whats-new › 2026-04-14-query-your-elasticsearch-data-with-more-flexibility-using-dsl-and-es-ql
Query your Elasticsearch data with more flexibility using DSL and ES|QL | Grafana Labs
April 14, 2026 - Go beyond the visual query builder in Elasticsearch with a new raw query editor and support for two query languages: Elasticsearch Query DSL and ES|QL.
🌐
Elastic
elastic.co › elasticsearch labs › blogs › piping hot: bringing es|ql to your grafana dashboards using the elasticsearch plugin
Piping Hot: Bringing ES|QL to Your Grafana Dashboards Using the Elasticsearch Plugin - Elasticsearch Labs
July 1, 2026 - The Elasticsearch data source is ... available starting in Grafana 13.0. ES|QL is Elasticsearch's modern pipe-based query language that enables querying logs, metrics, and traces, and using Elasticsearch as a native Prometheus ...
🌐
Crown
ccgit.crown.edu › cyber-reels › grafana-elasticsearch-queries-a-step-by-step-guide-1764801929
Grafana Elasticsearch Queries: A Step-by-Step Guide
December 4, 2025 - One of the most crucial parts of the Elasticsearch data source configuration is defining the index pattern. This tells Grafana which Elasticsearch indices you want to query. You can use wildcards here, like logstash-* to grab all indices starting with logstash.
🌐
Grafana
community.grafana.com › elasticsearch
Grafana Variables Query using ElasticSearch - Filter doesn't work - Elasticsearch - Grafana Labs Community Forums
November 7, 2022 - am currently using Grafana v9.1.7 and ElasticSearch 8.4.2 What I’m trying to achieve is to create a dashboard that can filter the data by country. I have a keyword field named honeypot_country (it’s a string that mapped into keyword in elastic). When this filter is selected, it should only ...
🌐
Grafana
grafana.com › docs › grafana › latest › datasources › elasticsearch › template-variables
Elasticsearch template variables | Grafana documentation
The Elasticsearch data source supports two variable syntaxes for use in the Query field: $varname, such as hostname:$hostname, which is easy to read and write but doesn’t let you use a variable in the middle of a word. ... When the Multi-value or Include all value options are enabled, Grafana converts the labels from plain text to a Lucene-compatible condition.
🌐
Huihoo
docs.huihoo.com › grafana › 2.6 › datasources › elasticsearch › index.html
Elasticsearch - Grafana Documentation - Huihoo
The Elasticsearch query editor allows you to select multiple metrics and group by multiple terms or filters. Use the plus and minus icons to the right to add / remove metrics or group bys. Some metrics and group by have options, click the option text to expand the the row to view and edit metric ...
🌐
Grafana
grafana.github.io › grafonnet › API › query › elasticsearch › index.html
elasticsearch - Grafonnet
Set the datasource for this query. ... If hide is set to true, Grafana will filter out the response(s) associated with this query before returning it to the panel.
🌐
Grafana
community.grafana.com › configuration
How to write query for a variable for an elasticsearch source? - Configuration - Grafana Labs Community Forums
August 28, 2018 - In the dashboard settings, I want to create a variable so that I can have the option to see the metrics panel for that particular host. I cannot seem to figure out the correct query syntax for the fields that contains th…
🌐
Grafana
grafana.com › grafana › plugins › elasticsearch
Elasticsearch plugin for Grafana | Grafana Labs
July 13, 2026 - Grafana ships with advanced support for Elasticsearch. You can do many types of simple or complex elasticsearch queries to visualize logs or metrics stored in Elasticsearch.