Issues Displaying Non-Timeseries Data from Elasticsearch in Grafana

Hello,

I am a beginner who has just started using Grafana. I am currently using Grafana to display non-timeseries data retrieved from Elasticsearch (ES). My goal is to periodically display all data from a specific index. For instance, with an index named “demo”, I want Grafana to periodically run my query and display the results in a list-like format.

However, I am facing an issue where, upon connecting Grafana to my Elasticsearch, it prompts a “No data field named createTime” error. I have verified that the “createTime” field exists in every record within my ES index. Despite having this data field, no results are shown when I attempt to use this data source in Grafana.

I am seeking advice on the following:

  1. Possible reasons why Grafana is not displaying any data.
  2. How to effectively display non-timeseries data in Grafana using my current setup.

env:

  • grafana : v9.4.7
  • es: v8.8.2

Any suggestions or insights would be greatly appreciated. Thank you!

This is a example for my data in ES:

{
                "_index": "jdbc-monitor-sql-record",
                "_id": "1787401118389878784",
                "_score": 1.0,
                "_source": {
                    "id": "1787401118389878784",
                    "sqlId": 1787401118389878784,
                    "statementId": 1576936424,
                    "sql": "CREATE ALIAS DELAY FOR \"org.demo.H2Alias.delay\"",
                    "executeTime": 0.162978,
                    "stack": "com.alibaba.druid.pool.DruidPooledStatement:execute(-1)\norg.demo.test.connection.ApplicationTest:checkConnection(57)\norg.demo.test.connection.ApplicationTest:main(20)\n",
                    "createTime": [
                        2024,
                        5,
                        6
                    ]
                }
    },

welcome to forum @ericchen200001

that data point is not a proper datetime field but an array of numbers

which data points do you want tp visualize

Hi,here! In fact, I plan to display all the information from the source as a data table (to show all current SQL data)

I would like to know: (1) whether Grafana can display data in this way, and (2) I want to calculate and display the ten slowest SQL queries based on their execution time, which I believe is unrelated to whether the data is timeseries or not.

My project involves displaying some Prometheus metrics, such as the number of SQL queries and their execution times, which Grafana handles well. However, I also need to display detailed information about the slowest SQL queries on the same dashboard, including the SQL statements themselves and information about their call stacks.

1 Like

Is it appropriate to use grafana for this?

1 Like

table should work. use extract to extract the _source data piece.

Thank you so much! Could you provide me with some configuration examples for Queries and Transformers? I want to see if I can successfully retrieve data from my Elasticsearch. I read a response in the community mentioning that using ES in Kubernetes might lead to data retrieval issues, so if I can’t get the data, I need to contact the Kubernetes administrator.