mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 06:24:18 +02:00
fix typoe indicies to indices
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/alecthomas/repr"
|
||||
"gopkg.in/yaml.v3"
|
||||
@@ -68,6 +69,13 @@ type Config struct {
|
||||
Retention string // index template create: -r
|
||||
Rollover bool // index template create: -R
|
||||
|
||||
Missing bool // index copy: -m
|
||||
Sync bool // index copy: -S
|
||||
RequestsPerSecond float64 // index copy: -R
|
||||
Timeout time.Duration // index copy: -T
|
||||
Refresh bool // index copy: -r
|
||||
SourceIndices []string // index copy: -s
|
||||
|
||||
From, To, MaxItems int // search: flags
|
||||
Filter []string // search: -F
|
||||
Path string // search+doc sh: -p
|
||||
@@ -98,9 +106,10 @@ type Config struct {
|
||||
Hidden bool // ds ls: -H
|
||||
|
||||
// rollover
|
||||
MaxAge string
|
||||
MaxDocs, MaxShardSize, MaxShardDocs int // roll over
|
||||
DryRun bool // rollover: -n
|
||||
MaxAge string
|
||||
MaxDocs int64 // roll over, plus others
|
||||
MaxShardSize, MaxShardDocs int // roll over
|
||||
DryRun bool // rollover: -n
|
||||
|
||||
Tag string // api ls: -t
|
||||
HumanCat bool // api repl: -H
|
||||
|
||||
@@ -57,7 +57,7 @@ func CcrStatus(conf *cfg.Config, leader, follower string) error {
|
||||
res, err := conf.Clusters[alias].ES().Cat.Indices().
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get indicies on %s: %w", alias, esErrorString(err))
|
||||
return fmt.Errorf("failed to get indices on %s: %w", alias, esErrorString(err))
|
||||
}
|
||||
|
||||
indices[alias] = make(map[string]*types.IndicesRecord, len(res))
|
||||
|
||||
@@ -288,7 +288,7 @@ func gatherClusterStats(clusterstats *clusterstats.Response, table *printer.Tabl
|
||||
}
|
||||
|
||||
table.Entries = append(table.Entries, [][]any{
|
||||
{"Indicies", clusterstats.Indices.Count},
|
||||
{"indices", clusterstats.Indices.Count},
|
||||
{"Docs", clusterstats.Indices.Docs.Count},
|
||||
{"Total Size", printer.Bytes(clusterstats.Indices.Docs.TotalSizeInBytes)},
|
||||
{"Total Queries", "%d", querycount},
|
||||
|
||||
@@ -89,7 +89,7 @@ func checkClusterStatus(conf *cfg.Config, leader, follower string) bool {
|
||||
status[leader].ActivePrimaryShards,
|
||||
status[follower].ActivePrimaryShards,
|
||||
},
|
||||
{"Indicies",
|
||||
{"indices",
|
||||
len(status[leader].Indices),
|
||||
len(status[follower].Indices),
|
||||
},
|
||||
@@ -172,7 +172,7 @@ func findIlmErrors(conf *cfg.Config, leader, follower string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// find unsynchronized indicies only present on leader
|
||||
// find unsynchronized indices only present on leader
|
||||
func findIndicesOnlyOnLeader(conf *cfg.Config, indices ClusterIndices, leader, follower string) bool {
|
||||
exclude := regexp.MustCompile(DefaultExclude)
|
||||
if conf.Exclude != "" {
|
||||
|
||||
@@ -43,7 +43,7 @@ func IndexNames(conf *cfg.Config) ([]string, error) {
|
||||
res, err := conf.DefaultCluster.ES().Cat.Indices().
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get indicies: %w", esErrorString(err))
|
||||
return nil, fmt.Errorf("failed to get indices: %w", esErrorString(err))
|
||||
}
|
||||
|
||||
indices := make([]string, len(res))
|
||||
@@ -89,10 +89,10 @@ func IndexList(conf *cfg.Config) error {
|
||||
|
||||
res, err := cat.Do(context.Background())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get indicies: %w", esErrorString(err))
|
||||
return fmt.Errorf("failed to get indices: %w", esErrorString(err))
|
||||
}
|
||||
|
||||
slog.Debug("ES result", "indicies", res)
|
||||
slog.Debug("ES result", "indices", res)
|
||||
|
||||
list := filterIndices(conf, res)
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ func RolloverConditions(conf *cfg.Config) types.RolloverConditionsVariant {
|
||||
}
|
||||
|
||||
if conf.MaxDocs > 0 {
|
||||
cond.MaxDocs(int64(conf.MaxDocs))
|
||||
cond.MaxDocs(conf.MaxDocs)
|
||||
}
|
||||
|
||||
if conf.MaxShardSize > 0 {
|
||||
|
||||
@@ -42,17 +42,17 @@ type Snapshot struct {
|
||||
}
|
||||
|
||||
func SnapshotList(conf *cfg.Config) error {
|
||||
// get partial indicies
|
||||
// get partial indices
|
||||
ires, err := conf.DefaultCluster.ES().Cat.Indices().Do(context.Background())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get indicies: %w", esErrorString(err))
|
||||
return fmt.Errorf("failed to get indices: %w", esErrorString(err))
|
||||
}
|
||||
|
||||
indicies := map[string]int{}
|
||||
indices := map[string]int{}
|
||||
|
||||
for _, index := range ires {
|
||||
name := strings.ReplaceAll(*index.Index, "partial-", "")
|
||||
indicies[name] = 1
|
||||
indices[name] = 1
|
||||
}
|
||||
|
||||
// get snapshots
|
||||
@@ -61,7 +61,7 @@ func SnapshotList(conf *cfg.Config) error {
|
||||
return fmt.Errorf("failed to get snapshots: %w", esErrorString(err))
|
||||
}
|
||||
|
||||
slog.Debug("ES result", "indicies", sres)
|
||||
slog.Debug("ES result", "indices", sres)
|
||||
|
||||
snapshots := []*Snapshot{} // original snapshot names
|
||||
|
||||
@@ -74,7 +74,7 @@ func SnapshotList(conf *cfg.Config) error {
|
||||
Orphaned: "no",
|
||||
})
|
||||
|
||||
_, exists := indicies[snap.Forindex]
|
||||
_, exists := indices[snap.Forindex]
|
||||
if !exists {
|
||||
snap.Orphaned = "orphaned"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user