This repository was archived by the owner on Apr 15, 2025. It is now read-only.
File tree Expand file treeCollapse file tree 2 files changed+31
-0
lines changedFilter options
+31
-0
lines changed Original file line number Diff line number Diff line change
@@ -1630,6 +1630,21 @@ type AllocateStalePrimary struct {
1630
1630
AcceptDataLoss bool `json:"accept_data_loss,omitempty"`
1631
1631
}
1632
1632
1633
+
// Reroute allows to change the allocation of individual shards in the cluster.
1634
+
func (c *Client) Reroute() error {
1635
+
var urlBuilder strings.Builder
1636
+
urlBuilder.WriteString("_cluster/reroute?retry_failed=true")
1637
+
1638
+
agent := c.buildPostRequest(urlBuilder.String())
1639
+
1640
+
_, err := handleErrWithBytes(agent)
1641
+
if err != nil {
1642
+
return err
1643
+
}
1644
+
1645
+
return nil
1646
+
}
1647
+
1633
1648
// AllocateStalePrimary allows to manually allocate a stale primary shard to a specific node
1634
1649
func (c *Client) AllocateStalePrimaryShard(node, index string, shard int) error {
1635
1650
var urlBuilder strings.Builder
Original file line number Diff line number Diff line change
@@ -2180,6 +2180,22 @@ func TestClusterAllocationExplain(t *testing.T) {
2180
2180
}
2181
2181
}
2182
2182
2183
+
func TestReroute(t *testing.T) {
2184
+
testSetup := &ServerSetup{
2185
+
Method: "POST",
2186
+
Path: "/_cluster/reroute",
2187
+
}
2188
+
2189
+
host, port, ts := setupTestServers(t, []*ServerSetup{testSetup})
2190
+
defer ts.Close()
2191
+
client := NewClient(host, port)
2192
+
2193
+
err := client.Reroute()
2194
+
if err != nil {
2195
+
t.Fatalf("Unexpected error expected nil, got %s", err)
2196
+
}
2197
+
}
2198
+
2183
2199
func TestAllocateStalePrimaryShard(t *testing.T) {
2184
2200
testSetup := &ServerSetup{
2185
2201
Method: "POST",
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4