Counting values in a field (value_count - Elasticsearch)

hello,

I’m using Grafana to display metrics from Elasticsearch.

I want to count the number of values in a field and shows them in a graph

Like I do in Elasticsearch

for example:

POST /sales/_search?size=0
{
“aggs” : {
“types_count” : { “value_count” : { “field” : “type” } }
}
}

Regards