Browse Source

Fix raw document query on ES 5.x

Leandro Piccilli 9 years ago
parent
commit
717a96ab8d
1 changed files with 6 additions and 1 deletions
  1. 6 1
      public/app/plugins/datasource/elasticsearch/query_builder.js

+ 6 - 1
public/app/plugins/datasource/elasticsearch/query_builder.js

@@ -102,7 +102,12 @@ function (queryDef) {
     query.size = 500;
     query.sort = {};
     query.sort[this.timeField] = {order: 'desc', unmapped_type: 'boolean'};
-    query.fields = ["*", "_source"];
+
+    // fields field not supported on ES 5.x
+    if (this.esVersion < 5) {
+      query.fields = ["*", "_source"];
+    }
+
     query.script_fields = {},
     query.fielddata_fields = [this.timeField];
     return query;