Просмотр исходного кода

Fix for annotations query on ES 5.x

Leandro Piccilli 9 лет назад
Родитель
Сommit
f844cd844b
1 измененных файлов с 5 добавлено и 1 удалено
  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 query = { "bool": { "must": [{ "range": range }, { "query_string": { "query": queryInterpolated } }] }};
 
 
       var data = {
       var data = {
-        "fields": [timeField, "_source"],
         "query" : query,
         "query" : query,
         "size": 10000
         "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};
       var header = {search_type: "query_then_fetch", "ignore_unavailable": true};
 
 
       // old elastic annotations had index specified on them
       // old elastic annotations had index specified on them