Creating a connection pool using all nodes in AWS opensearch cluster

152 Views Asked by At

I am using OpenSearch.Net client to connect to AWS opensearch. I want to use multiple nodes in a connection pool by following the example in this doc, but I would like to get the nodes through the /nodes API. However, it seems that we have to manually pass in all the nodes, like this:

var nodes = new Uri[]
{
    new Uri("http://myserver1:9200"),
    new Uri("http://myserver2:9200"),
    new Uri("http://myserver3:9200")
};

var pool = new StaticConnectionPool(nodes);
var settings = new ConnectionSettings(pool);
var client = new OpenSearchClient(settings);

So I would like to make use of the /node API to get all the nodes and then pass it to the connection pool object. Obviously I can't do eat easily because in order to call the /node API, I will have to connect to AWS opensearch in the first place (chicken and egg).

Is there a way around this? How can I create a connection pool based on the existing nodes of my opensearch cluster?

0

There are 0 best solutions below