Browse Source

Fix for annotations query on ES 5.x

Leandro Piccilli 9 years ago
parent
commit
f844cd844b
1 changed files with 5 additions and 1 deletions
  1. 5 1
      public/app/plugins/datasource/elasticsearch/datasource.js

+ 5 - 1
public/app/plugins/datasource/elasticsearch/datasource.js

@@ -82,11 +82,15 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
       var query = { "bool": { "must": [{ "range": range }, { "query_string": { "query": queryInterpolated } }] }};
 
       var data = {
-        "fields": [timeField, "_source"],
         "query" : query,
         "size": 10000
       };
 
+      // fields field not supported on ES 5.x
+      if (this.esVersion < 5) {
+        data["fields"] = [timeField, "_source"];
+      }
+
       var header = {search_type: "query_then_fetch", "ignore_unavailable": true};
 
       // old elastic annotations had index specified on them