I’m new to Grafana so I just installed it yesterday. I’ve created a pie chart from three Elasticsearch queries but I don’t see how I can label them correctly in the legend. There are no fields in Elasticsearch that represent what the queries are. These are phone calls and should be labeled something along the lines of ‘incoming’, ‘outgoing’ and ‘internal’. Yet, all fields simply show ‘count’. I’ve seen many other people have had issues getting the labels correct but none of the solutions I’ve found seem to apply to my exact situation.
Hi,
You can put this in the legend field:
{{term your.field.to.display}}
Hope this helps.
Regards,
Fadjar Tandabawana
Thank you for your suggestion but there’s no field in the Elasticsearch database that represents the label for the record type.
Hi,
Can you show your queries?
Because if there are specific query for each count, you can put the legend as you need.
Regards,
Fadjar Tandabawana
For internal calls, the query is: InternalIndicator:I
For outgoing calls, the query is: CallingNumber:101*
For incoming calls, the query is: CallingParty:T* AND NOT InternalIndicator:I
Thank you for your help with this.
Hi,
It’s easy enough:
For internal calls, the query is: InternalIndicator:I → legend: Internal
For outgoing calls, the query is: CallingNumber:101* → Legend: Outgoing
For incoming calls, the query is: CallingParty:T* AND NOT InternalIndicator:I → Legend: Incoming
Then your legend will appears as you wanted.
Regards,
Fadjar Tandabawana
Where exactly and what exactly do I enter? I tried doing “Legend: Internal” in the ‘Alias’ but putting anything in there makes the search for that entire item disappear. I see ‘Display Name’ in the legend settings. Is that where I need to enter something? Thank you again for your help.
Hi,
Sorry, my bad… I just used to using Prometheus.
For Elasticsearch just put “Internal” into the Alias as your internal query, respectively.
Let me know what happen then.
Regards,
Fadjar Tandabawana
Hi,
Try to fill the unit with “None”
And if still disappeared, try to use Override option, before use Override, fill the Alias first with proper word, then do the override per value.
Regards,
Fadjar Tandabawana
I tried overriding the ‘Unit’ with ‘none’ but it didn’t change anything. I don’t know if I’m doing it correctly but I tried creating an override for the display name but I don’t see any value I can replace manually.
Before I posted by question, I found the following post having the same issue but I was hoping something was different since I’m using the newest version of Grafana. The most important part are the last few comments.
https://community.grafana.com/t/separate-name-alias-for-each-metric-in-legend/5073/4
Thank you for trying to help. It’s disappointing Grafana can’t do something so simple. Thanks again though.