Hello OpenSearch Community,
I’m currently exploring OpenSearch-Go and AWS integration and have stumbled upon the following code snippet:
ctx := context.Background()
cfg, _ := config.LoadDefaultConfig(ctx)
endpoint, endpoint_present := os.LookupEnv(“ENDPOINT”)
if !endpoint_present {
return errors.New(“ENDPOINT missing”)
}
service, service_present := os.LookupEnv(“SERVICE”)
if !service_present {
service = “es”
}
signer, err := requestsigner.NewSignerWithService(cfg, service)
if err != nil {
return err
}
client, err := opensearchapi.NewClient(
opensearchapi.Config{
Client: opensearch.Config{
Addresses: string{endpoint},
Signer: signer,
},
},
)
My understanding is that OpenSearch maintains an internal HTTP connection pool. However, I’m uncertain about its behavior when a connection is revoked. Will it be able to create a new connection automatically? Additionally, the credentials obtained during the initialization of the application may be valid for only one hour. How should connection renewal be handled in such a scenario?
I would appreciate any insights or guidance on how to manage connection renewal effectively in the context of OpenSearch-Go integration.
Thank you for your assistance!
Best regards,
Sumantha