From 0a1c2a7024d9e1940e8df434a37d22998a8ab0a9 Mon Sep 17 00:00:00 2001 From: Victor Azevedo Date: Thu, 25 May 2017 11:43:29 -0400 Subject: [PATCH] use fielddata_fields in elasticsearch 2.x queries Resolves issue #8467 --- .../app/plugins/datasource/elasticsearch/query_builder.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/query_builder.js b/public/app/plugins/datasource/elasticsearch/query_builder.js index ecbbb9c7e48..62a7b379c8e 100644 --- a/public/app/plugins/datasource/elasticsearch/query_builder.js +++ b/public/app/plugins/datasource/elasticsearch/query_builder.js @@ -119,8 +119,12 @@ function (queryDef) { query.fields = ["*", "_source"]; } - query.script_fields = {}, - query.docvalue_fields = [this.timeField]; + query.script_fields = {}; + if (this.esVersion < 5) { + query.fielddata_fields = [this.timeField]; + } else { + query.docvalue_fields = [this.timeField]; + } return query; };