mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 22:24:21 +02:00
add --hidden flag (default off) to 'index ls' and 'ilm forecast ls' (#55)
This commit is contained in:
@@ -87,6 +87,12 @@ func IlmForecastList(conf *cfg.Config) *cli.Command {
|
||||
Destination: &conf.Verbose,
|
||||
Aliases: []string{"v"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "hidden",
|
||||
Usage: "include hidden indicies",
|
||||
Destination: &conf.Hidden,
|
||||
Aliases: []string{"H"},
|
||||
},
|
||||
},
|
||||
|
||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||
|
||||
@@ -70,6 +70,12 @@ func IndexList(conf *cfg.Config) *cli.Command {
|
||||
Destination: &conf.Partials,
|
||||
Aliases: []string{"p"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "hidden",
|
||||
Usage: "include hidden indicies",
|
||||
Destination: &conf.Hidden,
|
||||
Aliases: []string{"H"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "reds",
|
||||
Usage: "include only red failed indicies",
|
||||
|
||||
@@ -225,9 +225,7 @@ func getIlmPhaseData(conf *cfg.Config) ([]PhaseData, error) {
|
||||
}
|
||||
|
||||
for indexName, explain := range ilmdetails.Indices {
|
||||
if strings.HasPrefix(indexName, ".ds-") ||
|
||||
strings.HasPrefix(indexName, ".monitoring-") ||
|
||||
strings.HasPrefix(indexName, ".internal") {
|
||||
if !conf.Hidden && strings.HasPrefix(indexName, ".") {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -53,11 +53,16 @@ func IndexNames(conf *cfg.Config) ([]string, error) {
|
||||
func filterIndices(conf *cfg.Config, list indices.Response) indices.Response {
|
||||
// apply partials filter first
|
||||
selectedlist := indices.Response{}
|
||||
|
||||
for _, index := range list {
|
||||
if !conf.Partials && strings.HasPrefix(*index.Index, "partial-") {
|
||||
continue
|
||||
}
|
||||
|
||||
if !conf.Hidden && strings.HasPrefix(*index.Index, ".") {
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.HasPrefix(*index.Index, ".ds-") {
|
||||
// ignore data stream backing indicies
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user