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
-2
lines changedFilter options
+31
-2
lines changed Original file line number Diff line number Diff line change
@@ -710,6 +710,18 @@ func (c *Client) GetIndices(index string) ([]Index, error) {
710
710
return indices, nil
711
711
}
712
712
713
+
// Get a subset of indices including hidden ones
714
+
func (c *Client) GetHiddenIndices(index string) ([]Index, error) {
715
+
var indices []Index
716
+
err := handleErrWithStruct(c.buildGetRequest(fmt.Sprintf("_cat/indices/%s?h=health,status,index,pri,rep,store.size,docs.count&expand_wildcards=open,closed,hidden", index)), &indices)
717
+
718
+
if err != nil {
719
+
return nil, err
720
+
}
721
+
722
+
return indices, nil
723
+
}
724
+
713
725
// Get all the aliases in the cluster.
714
726
//
715
727
// Use case: You want to see some basic info on all the aliases of the cluster
@@ -1683,5 +1695,17 @@ func (c *Client) RemoveIndexILMPolicy(index string) error {
1683
1695
return err
1684
1696
}
1685
1697
1698
+
ilmHistoryIndices, err := c.GetHiddenIndices(fmt.Sprintf("%s*.ds-ilm-history-*", index))
1699
+
if err != nil {
1700
+
return err
1701
+
}
1702
+
1703
+
for _, ilmHistoryIndex := range ilmHistoryIndices {
1704
+
err = c.DeleteIndex(ilmHistoryIndex.Name)
1705
+
if err != nil {
1706
+
return err
1707
+
}
1708
+
}
1709
+
1686
1710
return nil
1687
1711
}
Original file line number Diff line number Diff line change
@@ -2214,12 +2214,17 @@ func TestAllocateStalePrimaryShard(t *testing.T) {
2214
2214
}
2215
2215
2216
2216
func TestRemoveIndexILMPolicy(t *testing.T) {
2217
-
testSetup := &ServerSetup{
2217
+
ilmRemoveTestSetup := &ServerSetup{
2218
2218
Method: "POST",
2219
2219
Path: "/test-index/_ilm/remove",
2220
2220
}
2221
+
getIndicesTestSetup := &ServerSetup{
2222
+
Method: "GET",
2223
+
Path: "/_cat/indices/test-index*.ds-ilm-history-*",
2224
+
Response: "[]",
2225
+
}
2221
2226
2222
-
host, port, ts := setupTestServers(t, []*ServerSetup{testSetup})
2227
+
host, port, ts := setupTestServers(t, []*ServerSetup{ilmRemoveTestSetup, getIndicesTestSetup})
2223
2228
defer ts.Close()
2224
2229
client := NewClient(host, port)
2225
2230
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