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 <sheltie.fusafusa@gmail.com> * delete defer Signed-off-by: sheltie <sheltie.fusafusa@gmail.com> * Revert "delete defer" This reverts commit 6852b1c67cdde37c97640f05340354ea51b29fb9. Signed-off-by: sheltie <sheltie.fusafusa@gmail.com> --------- Signed-off-by: sheltie <sheltie.fusafusa@gmail.com>
This commit is contained in:
parent
d22a534773
commit
94e11ab14d
|
@ -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 %}
|
Loading…
Reference in New Issue