grafana / piechart-panel

Pie Chart Panel Plugin
MIT License
151 stars 102 forks source link

support for elasticsearch #46

Open celevra opened 8 years ago

celevra commented 8 years ago

Hi,

should this plugin work with elasticsearch? it seems like it doesn't like elasticsearch. this is my query: image

is there something i can provide to dig deeper into the problem?

regards

gretamosa commented 8 years ago

In addition to terms aggregation, try to add a date histogram with your timestamp field. snapshot

dwerder commented 8 years ago

It would be nice, if this could be documented in the plugins readme ;)

sybrandy commented 8 years ago

@dwerder I believe that this is a Grafana thing and not just a Pie Chart issue. I've been working on dashboards recently and came across the same problem with the built-in Graph panel.

olivoarroba commented 6 years ago

It seems that the date histogram aggregation does allow the piechart to show information but this information is not accurate. The problem is that the piechart will take the last entry of the date histogram and display that single bucket as the pie chart. For example, the query inspector shows the following as an answer from elasticsearch: image Pie chart takes the last entry of the date buckets as the count for the key LTE, so the number if takes is 76, when the correct number is 154 matching documents.

miez commented 6 years ago

@olivoarroba I've got the same problem but after browsing the code I found the reason.

The default "valueName" is "current" for the Pie Chart. So it only uses the "doc_count" from the last "bucket".

You can easily change this behavior by editing the Pie Chart in Grafana. Goto the Options tab and under General you can select "total" for the "value". This is the sum of all "doc_count"s from all buckets and gives you the wanted result.

olivoarroba commented 6 years ago

Thanks @miez you are correct. By changing the value to "total" will do the trick.