Skip to content

Commit

Permalink
Merge pull request #98 from github/hugodorea/fixes-cluster-allocation…
Browse files Browse the repository at this point in the history
…-explain-shard-type

changes shard field from string to *int in ClusterAllocationExplainRe…
  • Loading branch information
hugodorea authored Aug 12, 2022
2 parents 102f5bf + 1fd18dc commit d0d3dd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion es.go
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ type ClusterAllocationExplainRequest struct {
Primary bool `json:"primary,omitempty"`

// Specifies the ID of the shard that you would like an explanation for.
Shard string `json:"shard,omitempty"`
Shard *int `json:"shard,omitempty"`
}

// ClusterAllocationExplain provides an explanation for a shard’s current allocation.
Expand Down
5 changes: 3 additions & 2 deletions es_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2103,6 +2103,7 @@ func TestGetNodesHotThreads(t *testing.T) {
}

func TestClusterAllocationExplain(t *testing.T) {
shardID := 0
tests := []struct {
name string
request *ClusterAllocationExplainRequest
Expand Down Expand Up @@ -2138,9 +2139,9 @@ func TestClusterAllocationExplain(t *testing.T) {
{
name: "with shard set",
request: &ClusterAllocationExplainRequest{
Shard: "test-shard",
Shard: &shardID,
},
expectedBody: `{"shard":"test-shard"}`,
expectedBody: `{"shard":0}`,
},
{
name: "with pretty output",
Expand Down

0 comments on commit d0d3dd7

Please sign in to comment.