Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch lucene query in grafana

I have Grafana 2.6 and Elasticsearch 1.6.2 as datasource

on each of my documents, I have a field "status" that can have the values "Queued", "Complete"

I would like to graph the number of documents with status:Queued on time

here is 1 document:

{
  "_index": "myindex",
  "_type": "e_sdoc",
  "_id": "AVHFTlZiGCWSWOI9Qtj4",
  "_score": 3.2619324,
  "_source": {
    "status": "Queued",
    "update_date": "2015-12-04T00:01:35.589956",
    "md5": "738b67990f820ba28f3c10bc6c8b6ea3",
    "sender": "Someone",
    "type": "0",
    "last_client_update": "2015-11-18T18:13:32.879085",
    "uuid": "a80efd11-8ecc-4ef4-afb3-e8cd75d167ad",
    "name": "Europe",
    "insert_date": "2015-11-18T18:14:34.302295",
    "filesize": 10948809532,
    "is_online": "off",
    "id1": 77841,
    "id2": 53550932
  },
  "fields": {
    "insert_date": [
      1447870474302
    ],
    "update_date": [
      1449187295589
    ],
    "last_client_update": [
      1447870412879
    ]
  }
}

My question is: Grafana wants a lucene query to submit to ES but I have no idea what I should use

Have searched through the official doc, Grafana issues or looked into ES query made by Kibana but I can't find a valid syntax that is working :/

like image 669
exeral Avatar asked Dec 21 '15 16:12

exeral


People also ask

How do I use Elasticsearch in Grafana?

Open the side menu by clicking the Grafana icon in the top header. In the side menu under the Dashboards link you should find a link named Data Sources . Click the + Add data source button in the top header. Select Elasticsearch from the Type dropdown.

What query language is used in Grafana?

LogQL is Grafana Loki's PromQL-inspired query language.

How do I pull data from Grafana?

To export Grafana dashboards: Create a dashboard in a Grafana instance and save it. In the dashboard menu, click Share dashboard to export the dashboard to your computer. On the Export tab, enable to share externally and click Save to file.


1 Answers

time field was the problem. it seems there is no timestamp in my documents

edited my Elasticsearch datasource

changed 'Time field name' from @timestamp to update_date

I have now datapoints !

(see comments for the lucene query)

like image 86
exeral Avatar answered Oct 19 '22 15:10

exeral