Skip to content

Commit

Permalink
opensearchapi: add documentClient to rootClient
Browse files Browse the repository at this point in the history
Signed-off-by: Jakob Hahn <[email protected]>
  • Loading branch information
Jakob3xD committed Sep 19, 2023
1 parent d1cac71 commit 8fe743c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions opensearchapi/opensearchapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ type Config struct {
type Client struct {
Client *opensearch.Client
Cat catClient
Indices indicesClient
Nodes nodesClient
Cluster clusterClient
Dangling danglingClient
Document documentClient
Indices indicesClient
Nodes nodesClient
Script scriptClient
}

Expand All @@ -65,6 +66,7 @@ func clientInit(rootClient *opensearch.Client) *Client {
client.Cluster = clusterClient{apiClient: client}
client.Dangling = danglingClient{apiClient: client}
client.Script = scriptClient{apiClient: client}
client.Document = documentClient{apiClient: client}

return client
}
Expand Down Expand Up @@ -124,6 +126,9 @@ func parseError(resp *opensearch.Response) error {
return apiError
}

// ToDo: Parse 404 errors separate as they are not in one standard format
// https://github.com/opensearch-project/OpenSearch/issues/9988

var apiError Error
if err = json.Unmarshal(body, &apiError); err != nil {
return fmt.Errorf("%w: %w", ErrJSONUnmarshalBody, err)
Expand Down

0 comments on commit 8fe743c

Please sign in to comment.