How to use pie chart with es query?

I use pie chart with es query. When I only group by terms, it doesn’t work, I need use then by date histogram select timestamp and select options other than automatic it work.
for example:


I need show all data according to “relative time ranges” options.

by the way, my English is bad. I hope someone can understand what problem then i meet

Welcome to the Grafana forums!

Can you toggle the button at the top (Table View) to display your data in a table and then post screenshots of each table under your various scenarios?


like this

because it is product evn so I had to cover with mosaics,I’m sorry about that.

I think your data (in Table view) should NOT have a time field, and should have at least 1 category of data. I have never used Elasticsearch queries, but messing around with the dashboard at play.grafana.org, I got this for a 7-day view:

and

and got this for a Last 1 Hour view:

and



Name is the getcontactlist_code and value is the count,why the pie chart use all num as name event if the value of result is name

It looks like Grafana is interpreting the Getcontactlist_code (1432, 1200, 1100) as a numerical value and not as a string or name. Could you modify your data so that it’s called “Code 1432”, “Code 1200”, “Code 1100”, etc.? This may require a new reference table somewhere in your data.



it is hard to modify my data because the data is too large.
now I just need use the code to replace the ‘count’,but I’d know how to do that.
this is my last problem of using grafana.