Skip to content

Commit 8ed3714

Browse files
committed
Regenerate documentation
1 parent 44602cb commit 8ed3714

31 files changed

+207
-2
lines changed

docs/aggregations.asciidoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ The values are typically extracted from the fields of the document (using the fi
6666

6767
* <<top-hits-aggregation-usage,Top Hits Aggregation Usage>>
6868

69+
* <<top-metrics-aggregation-usage,Top Metrics Aggregation Usage>>
70+
6971
* <<value-count-aggregation-usage,Value Count Aggregation Usage>>
7072

7173
* <<weighted-average-aggregation-usage,Weighted Average Aggregation Usage>>
@@ -106,6 +108,8 @@ include::aggregations/metric/sum/sum-aggregation-usage.asciidoc[]
106108

107109
include::aggregations/metric/top-hits/top-hits-aggregation-usage.asciidoc[]
108110

111+
include::aggregations/metric/top-metrics/top-metrics-aggregation-usage.asciidoc[]
112+
109113
include::aggregations/metric/value-count/value-count-aggregation-usage.asciidoc[]
110114

111115
include::aggregations/metric/weighted-average/weighted-average-aggregation-usage.asciidoc[]

docs/aggregations/bucket/parent/parent-aggregation-usage.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ new ParentAggregation("name_of_parent_agg", typeof(CommitActivity)) <1>
4747
}
4848
----
4949
<1> `join` field is determined from the _child_ type. In this example, it is `CommitActivity`
50+
5051
<2> sub-aggregations are on the type determined from the `join` field. In this example, a `Project` is a parent of `CommitActivity`
5152

5253
[source,javascript]

docs/aggregations/metric/boxplot/boxplot-aggregation-usage.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
:ref_current: https://www.elastic.co/guide/en/elasticsearch/reference/master
1+
:ref_current: https://www.elastic.co/guide/en/elasticsearch/reference/7.7
22

33
:github: https://github.com/elastic/elasticsearch-net
44

@@ -7,7 +7,7 @@
77
////
88
IMPORTANT NOTE
99
==============
10-
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/master/src/Tests/Tests/Aggregations/Metric/Boxplot/BoxplotAggregationUsageTests.cs.
10+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/7.x/src/Tests/Tests/Aggregations/Metric/Boxplot/BoxplotAggregationUsageTests.cs.
1111
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
1212
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
1313
////
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
:ref_current: https://www.elastic.co/guide/en/elasticsearch/reference/7.7
2+
3+
:github: https://github.com/elastic/elasticsearch-net
4+
5+
:nuget: https://www.nuget.org/packages
6+
7+
////
8+
IMPORTANT NOTE
9+
==============
10+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/7.x/src/Tests/Tests/Aggregations/Metric/TopMetrics/TopMetricsAggregationUsageTests.cs.
11+
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
12+
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
13+
////
14+
15+
[[top-metrics-aggregation-usage]]
16+
=== Top Metrics Aggregation Usage
17+
18+
The top metrics aggregation selects metrics from the document with the largest or smallest "sort" value.
19+
20+
Top metrics is fairly similar to "top hits" in spirit but because it is more limited it is able to do its job using less memory and is often faster.
21+
22+
Be sure to read the Elasticsearch documentation on {ref_current}/search-aggregations-metrics-top-metrics.html[Top Metrics Aggregation]
23+
24+
==== Fluent DSL example
25+
26+
[source,csharp]
27+
----
28+
a => a
29+
.TopMetrics("tm", st => st
30+
.Metrics(m => m.Field(p => p.NumberOfContributors))
31+
.Size(10)
32+
.Sort(sort => sort
33+
.Ascending("numberOfContributors")
34+
)
35+
)
36+
----
37+
38+
==== Object Initializer syntax example
39+
40+
[source,csharp]
41+
----
42+
new TopMetricsAggregation("tm")
43+
{
44+
Metrics = new List<ITopMetricsValue>
45+
{
46+
new TopMetricsValue(Field<Project>(p => p.NumberOfContributors))
47+
},
48+
Size = 10,
49+
Sort = new List<ISort> { new FieldSort { Field = "numberOfContributors", Order = SortOrder.Ascending } }
50+
}
51+
----
52+
53+
[source,javascript]
54+
.Example json output
55+
----
56+
{
57+
"tm": {
58+
"top_metrics": {
59+
"metrics": [
60+
{
61+
"field": "numberOfContributors"
62+
}
63+
],
64+
"size": 10,
65+
"sort": [
66+
{
67+
"numberOfContributors": {
68+
"order": "asc"
69+
}
70+
}
71+
]
72+
}
73+
}
74+
}
75+
----
76+
77+
==== Handling Responses
78+
79+
[source,csharp]
80+
----
81+
response.ShouldBeValid();
82+
var topMetrics = response.Aggregations.TopMetrics("tm");
83+
topMetrics.Should().NotBeNull();
84+
topMetrics.Top.Should().NotBeNull();
85+
topMetrics.Top.Count.Should().BeGreaterThan(0);
86+
87+
var tipTop = topMetrics.Top.First();
88+
tipTop.Sort.Should().Should().NotBeNull();
89+
tipTop.Sort.Count.Should().BeGreaterThan(0);
90+
tipTop.Metrics.Should().NotBeNull();
91+
tipTop.Metrics.Count.Should().BeGreaterThan(0);
92+
----
93+

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/building-blocks/connection-pooling.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ var pool = new CloudConnectionPool(cloudId, credentials); <2>
9797
var client = new ElasticClient(new ConnectionSettings(pool));
9898
----
9999
<1> a username and password that can access Elasticsearch service on Elastic Cloud
100+
100101
<2> `cloudId` is a value that can be retrieved from the Elastic Cloud web console
101102

102103
This type of pool, like its parent the `SingleNodeConnectionPool`, is hardwired to opt out of

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 `HttpRequestException` or 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(() => VirtualClusterWith
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> disable 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
@@ -191,5 +193,6 @@ await audit.TraceCalls(
191193
);
192194
----
193195
<1> All the calls fail
196+
194197
<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
195198

0 commit comments

Comments
 (0)