mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 10:04:18 +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,
|
Destination: &conf.Verbose,
|
||||||
Aliases: []string{"v"},
|
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 {
|
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||||
|
|||||||
@@ -70,6 +70,12 @@ func IndexList(conf *cfg.Config) *cli.Command {
|
|||||||
Destination: &conf.Partials,
|
Destination: &conf.Partials,
|
||||||
Aliases: []string{"p"},
|
Aliases: []string{"p"},
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "hidden",
|
||||||
|
Usage: "include hidden indicies",
|
||||||
|
Destination: &conf.Hidden,
|
||||||
|
Aliases: []string{"H"},
|
||||||
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "reds",
|
Name: "reds",
|
||||||
Usage: "include only red failed indicies",
|
Usage: "include only red failed indicies",
|
||||||
|
|||||||
@@ -225,9 +225,7 @@ func getIlmPhaseData(conf *cfg.Config) ([]PhaseData, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for indexName, explain := range ilmdetails.Indices {
|
for indexName, explain := range ilmdetails.Indices {
|
||||||
if strings.HasPrefix(indexName, ".ds-") ||
|
if !conf.Hidden && strings.HasPrefix(indexName, ".") {
|
||||||
strings.HasPrefix(indexName, ".monitoring-") ||
|
|
||||||
strings.HasPrefix(indexName, ".internal") {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,11 +53,16 @@ func IndexNames(conf *cfg.Config) ([]string, error) {
|
|||||||
func filterIndices(conf *cfg.Config, list indices.Response) indices.Response {
|
func filterIndices(conf *cfg.Config, list indices.Response) indices.Response {
|
||||||
// apply partials filter first
|
// apply partials filter first
|
||||||
selectedlist := indices.Response{}
|
selectedlist := indices.Response{}
|
||||||
|
|
||||||
for _, index := range list {
|
for _, index := range list {
|
||||||
if !conf.Partials && strings.HasPrefix(*index.Index, "partial-") {
|
if !conf.Partials && strings.HasPrefix(*index.Index, "partial-") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !conf.Hidden && strings.HasPrefix(*index.Index, ".") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(*index.Index, ".ds-") {
|
if strings.HasPrefix(*index.Index, ".ds-") {
|
||||||
// ignore data stream backing indicies
|
// ignore data stream backing indicies
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user