2017-12-19 23:06:54 +08:00
|
|
|
import _ from "lodash";
|
2016-02-04 00:01:53 +08:00
|
|
|
|
|
|
|
|
export class ElasticConfigCtrl {
|
2017-12-19 23:06:54 +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-19 23:06:54 +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-19 23:06:54 +08:00
|
|
|
this.current.jsonData.maxConcurrentShardRequests =
|
|
|
|
|
this.current.jsonData.maxConcurrentShardRequests || 256;
|
2016-02-04 00:01:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
indexPatternTypes = [
|
2017-12-19 23:06:54 +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
|
|
|
];
|
|
|
|
|
|
|
|
|
|
esVersions = [
|
2017-12-19 23:06:54 +08:00
|
|
|
{ name: "2.x", value: 2 },
|
|
|
|
|
{ name: "5.x", value: 5 },
|
|
|
|
|
{ name: "5.6+", value: 56 }
|
2016-02-04 00:01:53 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
indexPatternTypeChanged() {
|
2017-12-19 23:06:54 +08:00
|
|
|
var def = _.find(this.indexPatternTypes, {
|
|
|
|
|
value: this.current.jsonData.interval
|
|
|
|
|
});
|
|
|
|
|
this.current.database = def.example || "es-index-name";
|
2016-02-04 00:01:53 +08:00
|
|
|
}
|
|
|
|
|
}
|