We are currently creating an olivere elastic client in our API like so:
elasticClient, err = elastic.NewClient(
elastic.SetURL(elasticSearchUrl),
elastic.SetSniff(false),
)
if err != nil {
logger.ApplicationError(err)
time.Sleep(3 * time.Second)
} else {
logger.Information("ElasticSearch: connected")
return elasticClient
}
...
The single instance client is then used for all in-coming API requests.
However, after a new Elastic cluster is redeployed the connection seems to be still pointing to the old instance since that elasticSearchUrl
was only used once for the initial connection.
This creates a problem when are new Elastic Cluster is deployed because a new connection is required.
What would be the best way to achieve a re-connect to the new Elastic Search cluster using this library?