Hi there,
I’m using Elasticsearch as the datasource and created a template to make the Dashboard update when some fields are changed.
So I created a template with 3 variables and one of them is of type constant.
The constant type variable is to be filled by user with numbers that can have dashes “-” in it. This is a Zip Code for Brazil so I can have only the first 5 digits or the full Zip Code like “12345-678”.
When I put the first 5 digits it works as expected and the Dashboard is updated with the correct values.
When I put the full Zip Code with “-” in contante type variable it seems like the query sent to Elasticsearch is not correct.
I used the browser to investigate what is going on and noticed that variable is escaped like that “12345\-678”.
Is there any workaround ?
Is there any other way to let customer input the Zip Code ?
I also tested the query in the Panel | Metrics | Query and the “-” works. The problem is only related to the template variable.
Thank you in advance. Regards, Ricardo
Hi,
That sounds a bit weird and I don’t know of any workaround for this problem right now. Seems like a bug. I suggest you to send a bug report at Grafanas GitHub repo.
Thanks
Marcus
In case anyone else comes across this post, you can now control how variables are escaped in queries:
${varname}
${varname:csv}
csv formatting for multi valued variables${varname:raw}
no escaping (very useful)
1 Like