From 1888708ca52b5d5e4a15546055ccb7799d616e2d Mon Sep 17 00:00:00 2001 From: Seuf Date: Tue, 8 May 2018 14:04:20 +0200 Subject: [PATCH] Templating : return __empty__ value when all value return nothing to prevent elasticsearch syntaxe error (#9701) --- public/app/features/templating/template_srv.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/app/features/templating/template_srv.ts b/public/app/features/templating/template_srv.ts index e7c1dc7f102..99a9f53d547 100644 --- a/public/app/features/templating/template_srv.ts +++ b/public/app/features/templating/template_srv.ts @@ -74,6 +74,9 @@ export class TemplateSrv { if (typeof value === 'string') { return luceneEscape(value); } + if (value instanceof Array && value.length === 0) { + return '__empty__'; + } var quotedValues = _.map(value, function(val) { return '"' + luceneEscape(val) + '"'; });