Merge branch 'keep_es_version' of https://github.com/replay/grafana into replay-keep_es_version

This commit is contained in:
Torkel Ödegaard
2015-12-03 18:08:26 +01:00
5 changed files with 66 additions and 3 deletions

View File

@@ -5,11 +5,18 @@ function () {
function ElasticQueryBuilder(options) {
this.timeField = options.timeField;
this.elasticsearchVersion = options.elasticsearchVersion;
}
ElasticQueryBuilder.prototype.getRangeFilter = function() {
var filter = {};
filter[this.timeField] = {"gte": "$timeFrom", "lte": "$timeTo"};
// elastic search versions 2.x require the time format to be specified
if (this.elasticsearchVersion >= 2) {
filter[this.timeField]["format"] = "epoch_millis";
}
return filter;
};
@@ -130,6 +137,10 @@ function () {
"min_doc_count": 0,
"extended_bounds": { "min": "$timeFrom", "max": "$timeTo" }
};
// elastic search versions 2.x require the time format to be specified
if (this.elasticsearchVersion >= 2) {
esAgg["date_histogram"]["format"] = "epoch_millis";
}
break;
}
case 'filters': {