Browse Source

Solve issue 3728

Conditionally add a format element to ES annotation queries
Volker Fröhlich 9 years ago
parent
commit
45186255cf
1 changed files with 4 additions and 0 deletions
  1. 4 0
      public/app/plugins/datasource/elasticsearch/datasource.js

+ 4 - 0
public/app/plugins/datasource/elasticsearch/datasource.js

@@ -74,6 +74,10 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
         to: options.range.to.valueOf(),
       };
 
+      if (this.esVersion >= 2) {
+        range[timeField]["format"] = "epoch_millis";
+      }
+
       var queryInterpolated = templateSrv.replace(queryString);
       var filter = { "bool": { "must": [{ "range": range }] } };
       var query = { "bool": { "should": [{ "query_string": { "query": queryInterpolated } }] } };