Skip to content

Commit

Permalink
opensearchapi: add ResponseShards struct
Browse files Browse the repository at this point in the history
Signed-off-by: Jakob Hahn <jakob.hahn@hetzner.com>
  • Loading branch information
Jakob3xD committed Oct 13, 2023
1 parent f1453aa commit bec09a2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions opensearchapi/opensearchapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,22 @@ func formatDuration(d time.Duration) string {
func ToPointer[V any](value V) *V {
return &value
}

// ResponseShards is a sub type of api repsonses containing information about shards
type ResponseShards struct {
Total int `json:"total"`
Successful int `json:"successful"`
Failed int `json:"failed"`
Failures []ResponseShardsFailure `json:"failures"`
Skipped int `json:"skipped"`
}

// ResponseShardsFailure is a sub type of ReponseShards containing information about a failed shard
type ResponseShardsFailure struct {
Shard int `json:"shard"`
Index any `json:"index"`
Reason struct {
Type string `json:"type"`
Reason string `json:"reason"`
} `json:"reason"`
}

0 comments on commit bec09a2

Please sign in to comment.