Templating with Elasticsearch, data refresh and timestamp

Hi,


Environment: Grafana 4.2.0 and elasticsearch 5.2.2

Problem:
We are using elasticsearch to collect various logging data from our applications. Each application has a unique id (GUID), wich is stored with every log entry this application has written. Using Grafana, I have build a simple dashboard visualizing the log entries over time. This works well, now to the problematic part.
To choose the displayed application, I have created a template variable looking for the applications id values. If I change the id, the display immediately changes the data. Fine, exactly what I want. But handling with GUIDs is not convenient, so I have created a lookup-index in elastic containig all applications id values and names. I have setup two template variables:

$AppName: {"find": "terms", "field": "name.keyword"}
$AppId: {"find": "terms", "field": "id.keyword","query":"name.keyword:$AppName"}

Both variables are set to Refresh=never, assuming Grafana would store the queried data somewhere in the dashboard. Both variables are filled well if I have set the date range of my dashboard to catch the timestamp of my lookup-index. The dashboard works like a charm at this moment, but only until I close it. If I reopen the dashboard, $AppName ist filled, but $AppId has only the value before closing last time. Setting Refresh=On Dashboard Load, the values can only be found if the date range of the query is wide enough to match the timestamp in my lookup index. So it seems that template queries including the time range defined in the dashboard, what will not work if I choose a small range.

Did I do something wrong? Is there any possibility to ignore the date range from the dashboard while refreshing template variables? Any hints to solve this problem?

Greetings
J├╝rgen

Both variables are set to Refresh=never, assuming Grafana would store the queried data somewhere in the dashboard.

Yes it does. So if you save the dashboard the current options in the variables will be saved with the dashboard. Refresh never variables will still be refreshed when a dependent variable change. So whenever you change value of $AppName (using dropdown) it will cause a refresh of AppId

OK, I understand. So there is no chance to supress the date range while query the datsource? Bummer! Maybe I can use the simple json datasource to solve my problem, will take a look at it.