diff --git a/public/app/features/org/datasourceEditCtrl.js b/public/app/features/org/datasourceEditCtrl.js index e2d5cc3d75d..dd526f69308 100644 --- a/public/app/features/org/datasourceEditCtrl.js +++ b/public/app/features/org/datasourceEditCtrl.js @@ -13,7 +13,7 @@ function (angular, _, config) { $scope.httpConfigPartialSrc = 'app/features/org/partials/datasourceHttpConfig.html'; - var defaults = {name: '', type: 'graphite', url: '', access: 'proxy' }; + var defaults = {name: '', type: 'graphite', url: '', access: 'proxy', jsonData: {'elasticsearchVersion': 2} }; $scope.indexPatternTypes = [ {name: 'No pattern', value: undefined}, @@ -24,6 +24,12 @@ function (angular, _, config) { {name: 'Yearly', value: 'Yearly', example: '[logstash-]YYYY'}, ]; + $scope.elasticsearchVersions = [ + {name: '0.x', value: 0}, + {name: '1.x', value: 1}, + {name: '2.x', value: 2}, + ]; + $scope.init = function() { $scope.isNew = true; $scope.datasources = []; diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index b4c27ed1d80..642195130cd 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -23,9 +23,11 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes this.name = datasource.name; this.index = datasource.index; this.timeField = datasource.jsonData.timeField; + this.elasticsearchVersion = datasource.jsonData.elasticsearchVersion; this.indexPattern = new IndexPattern(datasource.index, datasource.jsonData.interval); this.queryBuilder = new ElasticQueryBuilder({ - timeField: this.timeField + timeField: this.timeField, + elasticsearchVersion: this.elasticsearchVersion }); } diff --git a/public/app/plugins/datasource/elasticsearch/partials/config.html b/public/app/plugins/datasource/elasticsearch/partials/config.html index d1cb05801d6..ef596a4deef 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/config.html +++ b/public/app/plugins/datasource/elasticsearch/partials/config.html @@ -20,7 +20,7 @@
-