Strange difference with/without templating

Hi guys,

I meet a problem with “Templating”.
When I specify a query with templating values, I can see a large difference of metrics count.
For information:

Can you help me please ? Thanks

Grafana version : latest
Storage : ES 5.2

The first query has no query at all. What is your singlestat option set to? Avg, Max, Total? (Singlestat options tab).

You can investigate the query grafana sends to elasticsearch by opening chrome dev tools network tab

Thank you Torkel,
My singlestat option set to Total.

I think that the problem is because default size of templating is 500. Can we use an “illimity” option?

that is not needed just set date histogram interval to a high value (1y) so you can only one data point back.

The result is the same with an high size on templating or high value (1y) on date histogram…
I don’t understand why … :frowning:

I tested with an other template:

There are probably other documents there, so when you put in the filter, even with all variable options selected, not all documents match

Yes, I thought that too, but in fact no.
When I specify a large size on templating like : {“find”: “terms”, “type”: “string”, “field”: “netflow.ipv4_src_addr”, “size”: 999999999} , I see a strange error:

I only see this error when I have a lot of data in my ElasticSearch index

you can not have a template variable have a million values and expect Grafana to send all of them as a filter to elasticsearch.