We have an Elasticsearch index where each document is formatted like this:
{
"source_idx": "idx-name",
"search_type": "type",
"date": "YYYY-MM-DD",
"buckets": [
{
"key": "customer1",
"doc_count": 1921
},
{
"key": "customer2",
"doc_count": 306
},
{
"key": "customer3",
"doc_count": 257
},
...
]
}
This data is pre aggregated from our original logs. We would like to display this data in a simple vertical bar graph per customer. So for instance, for a graph for customer1 over the period 2018-06-01 to 2018-06-03 we want to retrieve the doc_count
values for customer1 from each document with a date
value in that period and display those values in the vertical bar chart. From what I can tell, the Grafana metric selector does not support raw values other than Raw Document
and only supports aggregates, e.g. Count, Sum, Average
etc.
My questions are:
Is it possible to display pre aggregated data like this the way we want in a vertical bar graph?
Any ideas on what a query for this would look like in Grafana? I have been separately trying raw ES queries in the hope of being able to use that as a clue to what the Grafana query would look like but have not had any luck yet.
Would this be possible if we changed the document structure in some way?
We cannot store the original logs these aggregates are built from as we do not have the resources to retain the data in ES.
Any thoughts are helpful. Thank you.