Compare commits

..

2 Commits

Author SHA1 Message Date
a5933e226b test release 2026-07-08 08:58:15 +02:00
5a74b2f72b no patch level 2026-07-08 08:47:28 +02:00
7 changed files with 11 additions and 55 deletions

View File

@@ -16,6 +16,7 @@ builds:
goos:
- linux
- darwin
tool: "go1.26.4"
changelog:
sort: asc

View File

@@ -6,8 +6,8 @@ labels:
steps:
goreleaser:
image: goreleaser/goreleaser
when:
event: [tag,manual]
# when:
# event: [tag,manual]
environment:
GITEA_TOKEN:
from_secret: DEPLOY_TOKEN

View File

@@ -75,10 +75,10 @@ func IndexList(conf *cfg.Config) *cli.Command {
Aliases: []string{"H"},
},
&cli.BoolFlag{
Name: "failed",
Name: "reds",
Usage: "include only red failed indicies",
Destination: &conf.Failed,
Aliases: []string{"f"},
Aliases: []string{"r"},
},
&cli.StringSliceFlag{
Name: "filter",

View File

@@ -189,7 +189,6 @@ func (cluster *Cluster) getDefaultOptions() []elasticsearch.Option {
cluster.getTransport(),
elastictransport.WithHeader(headers),
),
elasticsearch.WithCompatibilityMode(),
}
}
@@ -204,9 +203,7 @@ func (cluster *Cluster) getTransport() elastictransport.Option {
)
}
return elastictransport.WithTransport(
&CompatibilityTransport{Transport: transport},
)
return elastictransport.WithTransport(transport)
}
func (conf *Config) SetupES() error {

View File

@@ -82,9 +82,8 @@ type Config struct {
SortBy string // sort: -k
Ascending bool // sort: -a
All bool // doc + node ls: -a
Exclude string // cluster compare: -e (regexp)
Verbose bool // cluster status: -v
All, Verbose bool // cluster status: -a -v
Persistent, Transient, Default bool // cluster settings set: -p -t -D
Force bool // ccr follower renew: -f

View File

@@ -53,8 +53,6 @@ func (t *DebugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
contentline = buf.String()
}
req = fixRequestHeaders(req)
slog.Info("req", "host", req.URL.Host, "uri", req.URL.Path,
"body", content, "bodyline", contentline,
"headers", req.Header,
@@ -62,32 +60,3 @@ func (t *DebugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
return t.Transport.RoundTrip(req)
}
type CompatibilityTransport struct {
Transport http.RoundTripper
}
func (t *CompatibilityTransport) RoundTrip(req *http.Request) (*http.Response, error) {
req = fixRequestHeaders(req)
return t.Transport.RoundTrip(req)
}
// Fixes https://codeberg.org/scip/esctl/issues/79:
// the API client has this Accept header hardcoded everywhere:
// req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=9")
// While this works pretty well with ES9, it doesn't with ES8. So, we replace
// this header with a new one without the compatibility part.
func fixRequestHeaders(req *http.Request) *http.Request {
if req.Header.Get("Accept") != "" {
req.Header.Del("Accept")
req.Header.Add("Accept", "application/json")
}
if req.Header.Get("Content-Type") != "" {
req.Header.Del("Content-Type")
req.Header.Add("Content-Type", "application/json")
}
return req
}

View File

@@ -174,16 +174,11 @@ func ClusterStatus(conf *cfg.Config) error {
}
// look for red indices, if any
failedIndices := 0
greenIndices := 0
redindices := 0
for _, index := range *res.indices {
switch {
case *index.Health != "green":
failedIndices++
case !strings.HasPrefix(*index.Index, "."):
// don't count internal indices
greenIndices++
if *index.Health == "red" {
redindices++
}
}
@@ -210,8 +205,7 @@ func ClusterStatus(conf *cfg.Config) error {
{"Unassigned Primary Shards", res.health.UnassignedPrimaryShards},
{"Pending Tasks", res.health.NumberOfPendingTasks},
{"Nodes", res.health.NumberOfNodes},
{"Green Indices", greenIndices},
{"Failed Indices", failedIndices},
{"Red Indices", redindices},
{"Long Running Tasks", longtasks},
}
@@ -239,10 +233,6 @@ func ClusterStatus(conf *cfg.Config) error {
for resource, items := range diag.AffectedResources {
table.Entries = append(table.Entries, []any{" -> affected " + resource, strings.Join(items, ",")})
}
if diag.Action != "" {
table.AddRow(" -> suggested action to fix", diag.Action)
}
}
}
}