OpenSearch (or ElasticSearch) has a SQL plug-in that is accessible via /_plugins/_sql
URL.
I can run a SQL Query on the ES Dashboard using a query like this:
POST /_plugins/_sql
{
"query": "SELECT test_name,sum(run-time) FROM test_metrics GROUP BY test_name"
}
I'm trying to figure out how can I add this SQL plug-in as a datasource in Grafana so that I can run a similar query via Grafana?
Thanks for @Jan Garaj for the pointer, I was able to find a plugin that works for this purpose.
JSON
Backend
URL
<OPENSEARCH_SERVICE_IP>/_plugin/_sql
URL Options
POST
Raw
JSON
{ "query": "SELECT * FROM ES_DATA_INDEX_NAME }
datarows
0
as: time