Skip to content

Commit 0bac181

Browse files
committed
update docs
1 parent 803afd1 commit 0bac181

19 files changed

+73
-0
lines changed

docs/aggregations/writing-aggregations.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ return s => s
232232
);
233233
----
234234
<1> a list of aggregation functions to apply
235+
235236
<2> Using LINQ's `Aggregate()` function to accumulate/apply all of the aggregation functions
236237

237238
[[handling-aggregate-response]]
@@ -275,5 +276,6 @@ var maxPerChild = childAggregation.Max("max_per_child");
275276
maxPerChild.Should().NotBeNull(); <2>
276277
----
277278
<1> Do something with the average per child. Here we just assert it's not null
279+
278280
<2> Do something with the max per child. Here we just assert it's not null
279281

docs/client-concepts/connection-pooling/exceptions/unexpected-exceptions.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ audit = await audit.TraceUnexpectedException(
5858
);
5959
----
6060
<1> set up a cluster with 10 nodes
61+
6162
<2> where node 2 on port 9201 always throws an exception
63+
6264
<3> The first call to 9200 returns a healthy response
65+
6366
<4> ...but the second call, to 9201, returns a bad response
6467

6568
Sometimes, an unexpected exception happens further down in the pipeline. In this scenario, we
@@ -98,7 +101,9 @@ audit = await audit.TraceUnexpectedException(
98101
);
99102
----
100103
<1> calls on 9200 set up to throw a `WebException`
104+
101105
<2> calls on 9201 set up to throw an `Exception`
106+
102107
<3> Assert that the audit trail for the client call includes the bad response from 9200 and 9201
103108

104109
An unexpected hard exception on ping and sniff is something we *do* try to recover from and failover to retrying on the next node.
@@ -143,6 +148,8 @@ audit = await audit.TraceUnexpectedException(
143148
);
144149
----
145150
<1> `InnerException` is the exception that brought the request down
151+
146152
<2> The hard exception that happened on ping is still available though
153+
147154
<3> An exception can be hard to relate back to a point in time, so the exception is also available on the audit trail
148155

docs/client-concepts/connection-pooling/exceptions/unrecoverable-exceptions.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ var audit = new Auditor(() => Framework.Cluster
8181
);
8282
----
8383
<1> Always succeed on ping
84+
8485
<2> ...but always fail on calls with a 401 Bad Authentication response
8586

8687
Now, let's make a client call. We'll see that the first audit event is a successful ping
@@ -101,7 +102,9 @@ audit = await audit.TraceElasticsearchException(
101102
);
102103
----
103104
<1> First call results in a successful ping
105+
104106
<2> Second call results in a bad response
107+
105108
<3> The reason for the bad response is Bad Authentication
106109

107110
When a bad authentication response occurs, the client attempts to deserialize the response body returned;
@@ -135,6 +138,7 @@ audit = await audit.TraceElasticsearchException(
135138
);
136139
----
137140
<1> Always return a 401 bad response with a HTML response on client calls
141+
138142
<2> Assert that the response body bytes are null
139143

140144
Now in this example, by turning on `DisableDirectStreaming()` on `ConnectionSettings`, we see the same behaviour exhibited
@@ -169,5 +173,6 @@ audit = await audit.TraceElasticsearchException(
169173
);
170174
----
171175
<1> Response bytes are set on the response
176+
172177
<2> Assert that the response contains `"nginx/"`
173178

docs/client-concepts/connection-pooling/request-overrides/disable-sniff-ping-per-request.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ audit = await audit.TraceCalls(
6565
);
6666
----
6767
<1> disable sniffing
68+
6869
<2> first call is a successful ping
70+
6971
<3> sniff on startup call happens here, on the second call
72+
7073
<4> No sniff on startup again
7174

7275
Now, let's disable pinging on the request
@@ -90,6 +93,7 @@ audit = await audit.TraceCall(
9093
);
9194
----
9295
<1> disable ping
96+
9397
<2> No ping after sniffing
9498

9599
Finally, let's demonstrate disabling both sniff and ping on the request
@@ -111,5 +115,6 @@ audit = await audit.TraceCall(
111115
);
112116
----
113117
<1> diable ping and sniff
118+
114119
<2> no ping or sniff before the call
115120

docs/client-concepts/connection-pooling/round-robin/skip-dead-nodes.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ await audit.TraceCalls(
140140
);
141141
----
142142
<1> The first call goes to 9200 which succeeds
143+
143144
<2> The 2nd call does a ping on 9201 because its used for the first time. It fails so we wrap over to node 9202
145+
144146
<3> The next call goes to 9203 which fails so we should wrap over
145147

146148
A cluster with 2 nodes where the second node fails on ping
@@ -190,5 +192,6 @@ await audit.TraceCalls(
190192
);
191193
----
192194
<1> All the calls fail
195+
193196
<2> After all our registered nodes are marked dead we want to sample a single dead node each time to quickly see if the cluster is back up. We do not want to retry all 4 nodes
194197

docs/client-concepts/connection-pooling/sniffing/role-detection.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ var audit = new Auditor(() => Framework.Cluster
138138
};
139139
----
140140
<1> Before the sniff, assert we only see three master only nodes
141+
141142
<2> After the sniff, assert we now know about the existence of 20 nodes.
142143

143144
After the sniff has happened on 9200 before the first API call, assert that the subsequent API
@@ -218,7 +219,9 @@ var audit = new Auditor(() => Framework.Cluster
218219
};
219220
----
220221
<1> for testing simplicity, disable pings
222+
221223
<2> We only want to execute API calls to nodes in rack_one
224+
222225
<3> After sniffing on startup, assert that the pool of nodes that the client will execute API calls against only contains the three nodes that are in `rack_one`
223226

224227
With the cluster set up, assert that the sniff happens on 9200 before the first API call
@@ -295,6 +298,8 @@ await audit.TraceUnexpectedElasticsearchException(new ClientCall
295298
});
296299
----
297300
<1> The audit trail indicates a sniff for the very first time on startup
301+
298302
<2> The sniff succeeds because the node predicate is ignored when sniffing
303+
299304
<3> when trying to do an actual API call however, the predicate prevents any nodes from being attempted
300305

docs/client-concepts/high-level/analysis/writing-analyzers.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ var createIndexResponse = _client.CreateIndex("my-index", c => c
104104
);
105105
----
106106
<1> Pre-defined list of English stopwords within Elasticsearch
107+
107108
<2> Use the `standard_english` analyzer configured
108109

109110
[source,javascript]
@@ -271,6 +272,7 @@ var createIndexResponse = _client.CreateIndex("questions", c => c
271272
);
272273
----
273274
<1> Use an analyzer at index time that strips HTML tags
275+
274276
<2> Use an analyzer at search time that does not strip HTML tags
275277

276278
With this in place, the text of a question body will be analyzed with the `index_question` analyzer

docs/client-concepts/high-level/getting-started.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ var indexResponse = client.IndexDocument(person); <1>
107107
var asyncIndexResponse = await client.IndexDocumentAsync(person); <2>
108108
----
109109
<1> synchronous method that returns an `IIndexResponse`
110+
110111
<2> asynchronous method that returns a `Task<IIndexResponse>` that can be awaited
111112

112113
NOTE: All methods available within NEST are exposed as both synchronous and asynchronous versions,

docs/client-concepts/high-level/inference/field-inference.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,15 @@ class Precedence
502502
}
503503
----
504504
<1> Even though this property has various attributes applied we provide an override on ConnectionSettings later that takes precedence.
505+
505506
<2> Has a `TextAttribute`, `PropertyNameAttribute` and a `JsonPropertyAttribute` - the `TextAttribute` takes precedence.
507+
506508
<3> Has both a `PropertyNameAttribute` and a `JsonPropertyAttribute` - the `PropertyNameAttribute` takes precedence.
509+
507510
<4> `JsonPropertyAttribute` takes precedence.
511+
508512
<5> This property we are going to hard code in our custom serializer to resolve to ask.
513+
509514
<6> We are going to register a DefaultFieldNameInferrer on ConnectionSettings that will uppercase all properties.
510515

511516
We'll create a custom `IPropertyMappingProvider` that renames any property named `AskSerializer` to `ask`.
@@ -551,7 +556,9 @@ usingSettings.Expect("data").ForField(Field<Precedence>(p => p.DataMember));
551556
usingSettings.Expect("DEFAULTFIELDNAMEINFERRER").ForField(Field<Precedence>(p => p.DefaultFieldNameInferrer));
552557
----
553558
<1> Rename on the mapping for the `Precedence` type
559+
554560
<2> Default inference for a field, if no other rules apply or are specified for a given field
561+
555562
<3> Hook up the custom `IPropertyMappingProvider`
556563

557564
The same naming rules also apply when indexing a document

docs/client-concepts/high-level/inference/indices-paths.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ singleIndexFromIndexName.Match(
8888
);
8989
----
9090
<1> `_all` will override any specific index names here
91+
9192
<2> The `Project` type has been mapped to a specific index name using <<index-name-type-mapping,`.DefaultMappingFor<Project>`>>
9293

9394
[[nest-indices]]
@@ -120,7 +121,9 @@ ISearchRequest singleTypedRequest = new SearchDescriptor<Project>().Index(single
120121
var invalidSingleString = Index("name1, name2"); <3>
121122
----
122123
<1> specifying a single index using a string
124+
123125
<2> specifying a single index using a type
126+
124127
<3> an **invalid** single index name
125128

126129
===== Multiple indices
@@ -146,7 +149,9 @@ manyStringRequest = new SearchDescriptor<Project>().Type(new[] { "name1", "name2
146149
((IUrlParameter)manyStringRequest.Type).GetString(this.Client.ConnectionSettings).Should().Be("name1,name2");
147150
----
148151
<1> specifying multiple indices using strings
152+
149153
<2> specifying multiple indices using types
154+
150155
<3> The index names here come from the Connection Settings passed to `TestClient`. See the documentation on <<index-name-inference, Index Name Inference>> for more details.
151156

152157
===== All Indices

0 commit comments

Comments
 (0)