Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Describe the issue:
I have a confusion regarding which of the the following modules in the OpenSearch Go client I need to use. I am writing a Go program that fetches data from OpenSearch. I will later be extending it to create monitors in OpenSearch.
github.com/opensearch-project/opensearch-go/v4
github.com/opensearch-project/opensearch-go/v4/opensearchapi
The example in OpenSearch Go documentation uses the opensearchapi module as follows to perform a search operation.
content := strings.NewReader(`{
"size": 5,
"query": {
"multi_match": {
"query": "miller",
"fields": ["title^2", "director"]
}
}
}`)
search := opensearchapi.SearchRequest{
Index: []string{"go-test-index1"},
Body: content,
}
searchResponse, err := search.Do(context.Background(), client)
However, the example in the user guide in the GitHub repository uses the opensearch module to perform the search request
// Search for the document.
content := strings.NewReader(`{
"size": 5,
"query": {
"multi_match": {
"query": "miller",
"fields": ["title^2", "director"]
}
}
}`)
searchResp, err := client.Search(
ctx,
&opensearchapi.SearchReq{
Body: content,
},
)
My question is, what is the recommended module to use? Is it opensearch or opensearchapi ?
Configuration:
Relevant Logs or Screenshots: