Can't create term aggregation graph from ES

Hi there,

Sorry if this is not the right place to submit what appears to be tickets. I’ve done so in GitHub, but not really sure it’s there, or here, since it’s specific to ES. We are evaluating Grafana. We need to create some standard terms aggretation graphs, with ES as the data source… but can’t do so. Date histogram and table works just fine. I already reviewed other posts in this group, with no luck to resolve our problem.

What Grafana version are you using? 4.5.1
What datasource are you using? ElasticSearch 5.x
What OS are you running grafana on? Linux (Ubuntu)

What did you do?
I created a date histogram from some ES index. Data come up just fine.

But when I try to do a terms aggregation by one field, I’m getting no results, and a message about defining a field name for the X-axis.

If I go to the Axes tab I can see the “Series” option, but selecting that one do nothing (dropdown remains blank).

I already checked the query using a table view, and that works fine. Also used the Dev tools in Chrome, and the response from ES was perfect:

I was surprized to see in #7470 that “Only time series is supported by graph panel still, you need the date histogram.”. Is that true? Should we forget about doing bar charts with ES as the data source? That would be a definitive show stopper, as 99% of our charts would be terms aggregations.

Thanks a lot!

The graph panel requires date histogram (time series) currently. You can sort of fake what you want by having the Terms aggregation, and date histogram with a very large interval (like 1y) so you only get one data point per series back. Then in Axes switch X-Axis option to Series mode.

Thank you Torkel, for your answer.

Is this a limitation with ElasticSearch data sources only, or it’s a general limitation of the graph panel? I just tried with MySQL, and came to similar results (was not able to create a bar chart over an aggregation results). I have a SQL query groping by year of birth, and want to display a bar chart with the top 10 birth years among our database:


I got the expected results from the query, but couldn’t translate that into a bar chart.

Is “bar charts” (or alike) something that’s being worked on (ability to easily create bar charts based on aggregation), or we shouldn’t expect an update any time soon?

Unfortunately for us, it’s key that the charts can be easily created (intuitively), as parts of our systems requires the end-users to create the ad-hoc reports on their own. So I don’t think the fake time series would fly… :frowning:

Again, thank you very much!

it’s a limitation in the graph panel, it only supports time series at the moment.

Is this functionality going to be implemented in the future?

+1 for this functionality as i mentioned here:
Should i create Feature Request in GitHub ?

I was trying to aggregate on terms and at the end I did it with table, which is actually better than a bar chart because I aggregate on URLs which could be quite long to display in x axis.

The workaround suggested by @torkel works. But then I get a “Data points ouside time range” error on the graph.
Any idea how to force Grafana not to show this error?