A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/github/vulcanizer/commit/a99df930dcd0323df95d245cdd3adc61b030abf6 below:

Merge pull request #102 from github/uyumazhakan/remove-ilm · github/vulcanizer@a99df93 · GitHub

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

+57

-0

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+57

-0

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

@@ -1673,3 +1685,27 @@ func (c *Client) AllocateStalePrimaryShard(node, index string, shard int) error

1673 1685 1674 1686

return nil

1675 1687

}

1688 + 1689 +

// RemoveIndexILMPolicy removes the ILM policy from the index

1690 +

func (c *Client) RemoveIndexILMPolicy(index string) error {

1691 +

agent := c.buildPostRequest(fmt.Sprintf("%s/_ilm/remove", index))

1692 + 1693 +

_, err := handleErrWithBytes(agent)

1694 +

if err != nil {

1695 +

return err

1696 +

}

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 + 1710 +

return nil

1711 +

}

Original file line number Diff line number Diff line change

@@ -2212,3 +2212,24 @@ func TestAllocateStalePrimaryShard(t *testing.T) {

2212 2212

t.Fatalf("Unexpected error. expected nil, got %s", err)

2213 2213

}

2214 2214

}

2215 + 2216 +

func TestRemoveIndexILMPolicy(t *testing.T) {

2217 +

ilmRemoveTestSetup := &ServerSetup{

2218 +

Method: "POST",

2219 +

Path: "/test-index/_ilm/remove",

2220 +

}

2221 +

getIndicesTestSetup := &ServerSetup{

2222 +

Method: "GET",

2223 +

Path: "/_cat/indices/test-index*.ds-ilm-history-*",

2224 +

Response: "[]",

2225 +

}

2226 + 2227 +

host, port, ts := setupTestServers(t, []*ServerSetup{ilmRemoveTestSetup, getIndicesTestSetup})

2228 +

defer ts.Close()

2229 +

client := NewClient(host, port)

2230 + 2231 +

err := client.RemoveIndexILMPolicy("test-index")

2232 +

if err != nil {

2233 +

t.Fatalf("Unexpected error. expected nil, got %s", err)

2234 +

}

2235 +

}

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