From 38790e2c4b69c76c42af0fa0c10d86b20d9bb4c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 2 Jun 2016 09:54:28 +0200 Subject: [PATCH] fix(elasticsearch): fixed templating lucene / json escaping issue, fixes #5228, fixes #5227 --- public/app/plugins/datasource/elasticsearch/datasource.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index d5926be3f81..f6095271b8e 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -205,7 +205,9 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes }; function escapeForJson(value) { - return value.replace(/\"/g, '\\"'); + return value + .replace(/\s/g, '\\ ') + .replace(/\"/g, '\\"'); } function luceneThenJsonFormat(value) {