From 94e11ab14dbaab386e01e71a6e57fe0a0eae22b3 Mon Sep 17 00:00:00 2001 From: sheltie Date: Tue, 21 Feb 2023 01:47:13 +0900 Subject: [PATCH] Add response close go client (#2828) * I think response need to close. The "Go package documentation" calls the Close method. https://pkg.go.dev/github.com/opensearch-project/opensearch-go#NewClient Signed-off-by: sheltie * delete defer Signed-off-by: sheltie * Revert "delete defer" This reverts commit 6852b1c67cdde37c97640f05340354ea51b29fb9. Signed-off-by: sheltie --------- Signed-off-by: sheltie --- _clients/go.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/_clients/go.md b/_clients/go.md index e6db8092..17095649 100644 --- a/_clients/go.md +++ b/_clients/go.md @@ -271,6 +271,7 @@ func main() { } fmt.Println("Inserting a document") fmt.Println(insertResponse) + defer insertResponse.Body.Close() // Perform bulk operations. blk, err := client.Bulk( @@ -314,6 +315,7 @@ func main() { } fmt.Println("Searching for a document") fmt.Println(searchResponse) + defer searchResponse.Body.Close() // Delete the document. delete := opensearchapi.DeleteRequest{ @@ -328,6 +330,7 @@ func main() { } fmt.Println("Deleting a document") fmt.Println(deleteResponse) + defer deleteResponse.Body.Close() // Delete the previously created index. deleteIndex := opensearchapi.IndicesDeleteRequest{ @@ -341,6 +344,7 @@ func main() { } fmt.Println("Deleting the index") fmt.Println(deleteIndexResponse) + defer deleteIndexResponse.Body.Close() } ``` {% include copy.html %} \ No newline at end of file