fix(elasticsearch): fixed proper json escaping for lucene query, fixes #2981

This commit is contained in:
Torkel Ödegaard
2015-10-22 16:23:21 -04:00
parent 87715d6231
commit ae93f2b936
3 changed files with 19 additions and 8 deletions

View File

@@ -159,7 +159,10 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
if (target.hide) {return;}
var esQuery = angular.toJson(this.queryBuilder.build(target));
esQuery = esQuery.replace("$lucene_query", target.query || '*');
var luceneQuery = angular.toJson(target.query || '*');
// remove inner quotes
luceneQuery = luceneQuery.substr(1, luceneQuery.length - 2);
esQuery = esQuery.replace("$lucene_query", luceneQuery);
payload += header + '\n' + esQuery + '\n';
sentTargets.push(target);