2017-12-20 19:33:33 +08:00
|
|
|
import _ from 'lodash';
|
2016-02-04 00:01:53 +08:00
|
|
|
|
|
|
|
|
export class ElasticConfigCtrl {
|
2017-12-20 19:33:33 +08:00
|
|
|
static templateUrl = 'public/app/plugins/datasource/elasticsearch/partials/config.html';
|
2016-02-04 00:01:53 +08:00
|
|
|
current: any;
|
|
|
|
|
|
|
|
|
|
/** @ngInject */
|
|
|
|
|
constructor($scope) {
|
2017-12-21 15:39:31 +08:00
|
|
|
this.current.jsonData.timeField = this.current.jsonData.timeField || '@timestamp';
|
2017-11-17 19:23:40 +08:00
|
|
|
this.current.jsonData.esVersion = this.current.jsonData.esVersion || 5;
|
2017-12-21 15:39:31 +08:00
|
|
|
this.current.jsonData.maxConcurrentShardRequests = this.current.jsonData.maxConcurrentShardRequests || 256;
|
2016-02-04 00:01:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
indexPatternTypes = [
|
2017-12-20 19:33:33 +08:00
|
|
|
{ name: 'No pattern', value: undefined },
|
|
|
|
|
{ name: 'Hourly', value: 'Hourly', example: '[logstash-]YYYY.MM.DD.HH' },
|
|
|
|
|
{ name: 'Daily', value: 'Daily', example: '[logstash-]YYYY.MM.DD' },
|
|
|
|
|
{ name: 'Weekly', value: 'Weekly', example: '[logstash-]GGGG.WW' },
|
|
|
|
|
{ name: 'Monthly', value: 'Monthly', example: '[logstash-]YYYY.MM' },
|
|
|
|
|
{ name: 'Yearly', value: 'Yearly', example: '[logstash-]YYYY' },
|
2016-02-04 00:01:53 +08:00
|
|
|
];
|
|
|
|
|
|
2017-12-21 15:39:31 +08:00
|
|
|
esVersions = [{ name: '2.x', value: 2 }, { name: '5.x', value: 5 }, { name: '5.6+', value: 56 }];
|
2016-02-04 00:01:53 +08:00
|
|
|
|
|
|
|
|
indexPatternTypeChanged() {
|
2018-08-29 20:27:29 +08:00
|
|
|
const def = _.find(this.indexPatternTypes, {
|
2017-12-20 19:33:33 +08:00
|
|
|
value: this.current.jsonData.interval,
|
2017-12-19 23:06:54 +08:00
|
|
|
});
|
2017-12-20 19:33:33 +08:00
|
|
|
this.current.database = def.example || 'es-index-name';
|
2016-02-04 00:01:53 +08:00
|
|
|
}
|
|
|
|
|
}
|