You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit improves the connection pooling docs by hiding test assertions from being output in documentation, and linking to sniffing and pinging behaviour docs.
@@ -23,8 +23,7 @@ NEST can use to issue client calls on.
23
23
Despite the name, a connection pool in NEST is **not** like connection pooling that you may be familiar with from
24
24
https://msdn.microsoft.com/en-us/library/bb399543(v=vs.110).aspx[interacting with a database using ADO.Net]; for example,
25
25
a connection pool in NEST is **not** responsible for managing an underlying pool of TCP connections to Elasticsearch,
26
-
this is https://blogs.msdn.microsoft.com/adarshk/2005/01/02/understanding-system-net-connection-management-and-servicepointmanager/[handled by the ServicePointManager in Desktop CLR]
27
-
and can be controlled by <<servicepoint-behaviour,changing the ServicePoint behaviour>> on `HttpConnection`.
26
+
this is https://blogs.msdn.microsoft.com/adarshk/2005/01/02/understanding-system-net-connection-management-and-servicepointmanager/[handled by the ServicePointManager in Desktop CLR].
28
27
29
28
--
30
29
@@ -60,51 +59,25 @@ your cluster through a single load balancer instance.
60
59
----
61
60
var uri = new Uri("http://localhost:9201");
62
61
var pool = new SingleNodeConnectionPool(uri);
63
-
pool.Nodes.Should().HaveCount(1);
64
-
var node = pool.Nodes.First();
65
-
node.Uri.Port.Should().Be(9201);
62
+
var client = new ElasticClient(new ConnectionSettings(pool));
66
63
----
67
64
68
-
This type of pool is hardwired to opt out of reseeding (thus, sniffing) as well as pinging
69
-
70
-
[source,csharp]
71
-
----
72
-
pool.SupportsReseeding.Should().BeFalse();
73
-
pool.SupportsPinging.Should().BeFalse();
74
-
----
65
+
This type of pool is hardwired to opt out of reseeding (<<sniffing-behaviour, sniffing>>) as well as <<pinging-behaviour, pinging>>
75
66
76
67
When you use the low ceremony `ElasticClient` constructor that takes a single `Uri`,
77
68
internally a `SingleNodeConnectionPool` is used
78
69
79
70
[source,csharp]
80
71
----
81
-
var client = new ElasticClient(uri);
82
-
client.ConnectionSettings.ConnectionPool
83
-
.Should().BeOfType<SingleNodeConnectionPool>();
84
-
----
85
-
86
-
However we urge that you always pass your connection settings explicitly
87
-
88
-
[source,csharp]
89
-
----
90
-
client = new ElasticClient(new ConnectionSettings(uri));
91
-
client.ConnectionSettings.ConnectionPool
92
-
.Should().BeOfType<SingleNodeConnectionPool>();
72
+
client = new ElasticClient(uri);
93
73
----
94
74
95
-
or even better pass the connection pool explicitly
96
-
97
-
[source,csharp]
98
-
----
99
-
client = new ElasticClient(new ConnectionSettings(pool));
100
-
client.ConnectionSettings.ConnectionPool
101
-
.Should().BeOfType<SingleNodeConnectionPool>();
102
-
----
75
+
However we encourage you to pass connection settings explicitly.
103
76
104
77
[[cloud-connection-pool]]
105
78
==== CloudConnectionPool
106
79
107
-
A specialized subclass of `SingleNodeConnectionPool that accepts a Cloud Id and credentials.
80
+
A specialized subclass of `SingleNodeConnectionPool` that accepts a Cloud Id and credentials.
108
81
When used the client will also pick Elastic Cloud optmized defaults for the connection settings.
109
82
110
83
A Cloud Id for your cluster can be fetched from your Elastic Cloud cluster administration console.
@@ -115,67 +88,26 @@ A Cloud Id should be in the form of `cluster_name:base_64_data` where `base_64_d
115
88
116
89
Out of these, only `host_name` and `elasticsearch_uuid` are always available.
0 commit comments