diff --git a/internal/event/target/elasticsearch.go b/internal/event/target/elasticsearch.go index ff721e639..a83e92b5d 100644 --- a/internal/event/target/elasticsearch.go +++ b/internal/event/target/elasticsearch.go @@ -34,7 +34,7 @@ import ( elasticsearch7 "github.com/elastic/go-elasticsearch/v7" "github.com/minio/highwayhash" "github.com/minio/minio/internal/event" - xioutil "github.com/minio/minio/internal/ioutil" + xhttp "github.com/minio/minio/internal/http" "github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/once" "github.com/minio/minio/internal/store" @@ -475,7 +475,7 @@ func (c *esClientV7) createIndex(args ElasticsearchArgs) error { if err != nil { return err } - defer xioutil.DiscardReader(resp.Body) + defer xhttp.DrainBody(resp.Body) if resp.IsError() { return fmt.Errorf("Create index err: %v", res) } @@ -491,7 +491,7 @@ func (c *esClientV7) ping(ctx context.Context, _ ElasticsearchArgs) (bool, error if err != nil { return false, store.ErrNotConnected } - xioutil.DiscardReader(resp.Body) + xhttp.DrainBody(resp.Body) return !resp.IsError(), nil } @@ -504,7 +504,7 @@ func (c *esClientV7) entryExists(ctx context.Context, index string, key string) if err != nil { return false, err } - xioutil.DiscardReader(res.Body) + xhttp.DrainBody(res.Body) return !res.IsError(), nil } @@ -519,7 +519,7 @@ func (c *esClientV7) removeEntry(ctx context.Context, index string, key string) if err != nil { return err } - defer xioutil.DiscardReader(res.Body) + defer xhttp.DrainBody(res.Body) if res.IsError() { return fmt.Errorf("Delete err: %s", res.String()) } @@ -547,7 +547,7 @@ func (c *esClientV7) updateEntry(ctx context.Context, index string, key string, if err != nil { return err } - defer xioutil.DiscardReader(res.Body) + defer xhttp.DrainBody(res.Body) if res.IsError() { return fmt.Errorf("Update err: %s", res.String()) } @@ -573,7 +573,7 @@ func (c *esClientV7) addEntry(ctx context.Context, index string, eventData event if err != nil { return err } - defer xioutil.DiscardReader(res.Body) + defer xhttp.DrainBody(res.Body) if res.IsError() { return fmt.Errorf("Add err: %s", res.String()) }