Elasticsearch parse_exception when Grafana template variable return blank string

The template variable returns a blank string in case of no possible output for a query, the Grafana makes a query to Elasticsearch is follows:
“query”:"ApplicationId:() AND Scope:()"
This leads to following exception in the elasticsaerch logs and on grafana console
_ “type”: “query_parsing_exception”,_
_ “reason”: “Failed to parse query [ApplicationId:() AND Scope:()]”,_
_ “index”: “appversiondetails”,_
_ “line”: 1,_
_ “col”: 213_
_ },_

The js file actually returns blank string in case of None or no output. Is it possible to handle this scenario or atleast provide a configuration where we can set some default value.
Currently to suppress such exceptions, I modify the js file.

Detail of the Issue
I was going through the Grafana Files for this issue and found the below code snippets in the boot.js file which plays an important role in the queries done to the elasticsearch:

  1. return{text:“None”,value:"",isNone:!0}

this.luceneFormat=function(n){return"string"==typeof n?t(n):"("+e.map(n,function(e){return’"’+t(e)+’"’}).join(" OR “)+”)"}

Possible Action
For rectifying this issue we can modify the JS file and define the queries that are fired to the ElasticSearch database.

  1. return{text:“None”,value:“none”,isNone:!0}

this.luceneFormat = function© {
if (“string” == typeof c) return a©;
var d = b.map(c, function(b) {
return ‘"’ + a(b) + ‘"’
if(d.length != 0) return “(” + d.join(" OR ") + “)”;
else return “none”;

The above code is from Grafana 4.6.3