# Connect to ElasticSearch through a wrapper

**URL:** <https://discuss.elastic.co/t/connect-to-elasticsearch-through-a-wrapper/242876>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [July 28, 2020, 10:13am UTC](https://discuss.elastic.co/t/connect-to-elasticsearch-through-a-wrapper/242876 "2020-07-28T10:13:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![itsbalur](https://avatars.discourse-cdn.com/v4/letter/i/d9b06d/32.png) [@itsbalur](https://discuss.elastic.co/u/itsbalur)\
**Post date:** [July 28, 2020, 10:13am UTC](https://discuss.elastic.co/t/connect-to-elasticsearch-through-a-wrapper/242876/1 "2020-07-28T10:13:08Z")

</div>

We use NEST API version 7.4 to connect to ES cluster with four nodes running v 7.4

The connection settings are as follows

```auto
    var nodeUrls = "url1~url2~url3~url4".Split('~').Select(u => new Uri(u));
    var nodes = nodeUrls.Select(u => new Node(u));
    var pool = new StickyConnectionPool(nodes);
    var settings = new ConnectionSettings(pool)
                        .DefaultIndex("indexName");

```

In our infrastructure, we control access to the ES nodes through IPs. This means that every new PC/laptop needs to be provided access.

I am thinking of having a .NET wrapper endpoint hosted on a server which has access to the ES nodes and using the wrapper end point in the application code instead of the node URLs directly. How do we configure this in NEST?

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [August 3, 2020, 11:33pm UTC](https://discuss.elastic.co/t/connect-to-elasticsearch-through-a-wrapper/242876/2 "2020-08-03T23:33:38Z")

</div>

> [@itsbalur](#):
>
> I am thinking of having a .NET wrapper endpoint hosted on a server which has access to the ES nodes and using the wrapper end point in the application code instead of the node URLs directly.

This sounds like a proxy in front of the cluster. In this scenario, the `SingleNodeConnectionPool` would be the one to use.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 31, 2020, 11:33pm UTC](https://discuss.elastic.co/t/connect-to-elasticsearch-through-a-wrapper/242876/3 "2020-08-31T23:33:47Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
