Skip to content

Commit af36fbc

Browse files
committed
Update documentation
1 parent eee5822 commit af36fbc

File tree

9 files changed

+37
-52
lines changed

9 files changed

+37
-52
lines changed

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ s => s
380380
.Aggregations(a => a
381381
.Terms("commits", st => st
382382
.Field(p => p.NumberOfCommits)
383-
.Include(partition: 0, numberOfPartitions: 50)
384-
.Size(2)
383+
.Include(partition: 0, numberOfPartitions: 10)
384+
.Size(5)
385385
)
386386
)
387387
----
@@ -396,8 +396,8 @@ new SearchRequest<Project>
396396
Aggregations = new TermsAggregation("commits")
397397
{
398398
Field = Infer.Field<Project>(p => p.NumberOfCommits),
399-
Include = new TermsInclude(0, 50),
400-
Size = 2
399+
Include = new TermsInclude(0, 10),
400+
Size = 5
401401
}
402402
}
403403
----
@@ -411,10 +411,10 @@ new SearchRequest<Project>
411411
"commits": {
412412
"terms": {
413413
"field": "numberOfCommits",
414-
"size": 2,
414+
"size": 5,
415415
"include": {
416416
"partition": 0,
417-
"num_partitions": 50
417+
"num_partitions": 10
418418
}
419419
}
420420
}

docs/aggregations/writing-aggregations.asciidoc

-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ return s => s
144144
);
145145
----
146146
<1> a list of aggregation functions to apply
147-
148147
<2> Using LINQ's `Aggregate()` function to accumulate/apply all of the aggregation functions
149148

150149
Combining multipe `AggregationDescriptor`'s is also possible using the bitwise `&` operator
@@ -212,6 +211,5 @@ var maxPerChild = childAggregation.Max("max_per_child");
212211
maxPerChild.Should().NotBeNull(); <2>
213212
----
214213
<1> Do something with the average per child. Here we just assert it's not null
215-
216214
<2> Do something with the max per child. Here we just assert it's not null
217215

docs/client-concepts/certificates/working-with-certificates.asciidoc

+21-18
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,31 @@ please modify the original csharp file found at the link and submit the PR with
1717

1818
=== Server Certificates
1919

20-
If you've enabled SSL on elasticsearch with x-pack or through a proxy in front of elasticsearch and the Certificate Authority (CA)
20+
If you've enabled SSL on Elasticsearch with x-pack or through a proxy in front of elasticsearch and the Certificate Authority (CA)
2121
That generated the certificate is trusted by the machine running the client code there should be nothing you'll have to do to to talk
2222
to over https with the client. If you are using your own CA which is not trusted .NET won't allow you to make https calls to that endpoint.
2323

24-
.NET allows you to preempt this though through a custom validation through the the global static `ServicePointManager.ServerCertificateValidationCallback`.
24+
In .NET, you can preempt this though through a custom validation through the the global static `ServicePointManager.ServerCertificateValidationCallback`.
2525
Most examples you will find on the .NET will simply return `true` from this delegate and call it quits. This is not advisable as this will allow any HTTPS
2626
traffic in the current AppDomain and not run any validations. Imagine you deploy a web app that talks to Elasticsearch over HTTPS but also some third party
27-
SOAP/WSDL endpoint setting `ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, errors) => true;` will skip validation of BOTH
28-
Elasticsearch and that external web service.
27+
SOAP/WSDL endpoint setting
2928

30-
.NET also allows you to set that callback per service endpoint and Elasticsearch.NET/NEST exposes this through connection settings.
31-
You can do your own validation in that handler or simply assign baked in handler that we ship with out of the box on the static
32-
class `CertificateValidations`.
29+
[source,csharp]
30+
----
31+
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, errors) => true;
32+
----
33+
34+
will skip validation for *both* Elasticsearch *and* that external web service.
3335

34-
The two most basic ones are `AllowAll` and `DenyAll` which does accept or deny any ssl trafic to our nodes`:
36+
You can also set a callback per service endpoint with .NET, and Elasticsearch.NET/NEST exposes this through the
37+
connection settings; You can do your own validation in that handler or simply assign one of the baked in handlers
38+
that we ship with out of the box, on the static class `CertificateValidations`.
3539

36-
If your client application however has access to the public CA certificate locally Elasticsearch.NET/NEST ships with handy helpers that assert
37-
that the certificate that the server presented was one that came from our local CA certificate. If you use x-pack's `certgen` tool to
38-
[generate SSL certificates] https://www.elastic.co/guide/en/x-pack/current/ssl-tls.html)[] the generated node certificate does not include the CA in the
40+
The two most basic ones are `AllowAll` and `DenyAll`, which accept or deny any SSL traffic to our nodes, respectively
41+
42+
If your client application however has access to the public CA certificate locally, Elasticsearch.NET/NEST ships with handy helpers that assert
43+
that the certificate that the server presented was one that came from our local CA certificate. If you use X-Pack's `certgen` tool to
44+
{xpack_current}/ssl-tls.html[generate SSL certificates], the generated node certificate does not include the CA in the
3945
certificate chain. This to cut back on SSL handshake size. In those case you can use `CertificateValidations.AuthorityIsRoot` and pass it your local copy
4046
of the CA public key to assert that the certificate the server presented was generated off that.
4147

@@ -47,9 +53,9 @@ generate the servers key.
4753

4854
=== Client Certificates
4955

50-
X-Pack also allows you to configure a [PKI realm] https://www.elastic.co/guide/en/x-pack/current/pki-realm.html)[] to enable user authentication
56+
X-Pack also allows you to configure a {xpack_current}/pki-realm.html[PKI realm] to enable user authentication
5157
through client certificates. The `certgen` tool included with X-Pack allows you to
52-
[generate client certificates as well] https://www.elastic.co/guide/en/x-pack/current/ssl-tls.html#CO13-4)[] and assign the distinguished name (DN) of the
58+
{xpack_current}/ssl-tls.html#CO13-4[generate client certificates as well] and assign the distinguished name (DN) of the
5359
certificate as a user with a certain role.
5460

5561
certgen by default only generates a public certificate `.cer`) and a private key `.key`. To authenticate with client certificates you need to present both
@@ -63,15 +69,13 @@ You can set Client Certificates to use on all connections on `ConnectionSettings
6369

6470
Or per request on `RequestConfiguration` which will take precedence over the ones defined on `ConnectionConfiguration`
6571

66-
=== Object Initializer Syntax Example
67-
6872
[source,csharp]
6973
----
7074
new RootNodeInfoRequest
7175
{
7276
RequestConfiguration = new RequestConfiguration
7377
{
74-
ClientCertificates = new X509Certificate2Collection { new X509Certificate2(this.BadCertificate) }
78+
ClientCertificates = new X509Certificate2Collection { new X509Certificate2(this.Certificate) }
7579
}
7680
}
7781
----
@@ -82,8 +86,7 @@ new RootNodeInfoRequest
8286
----
8387
s => s
8488
.RequestConfiguration(r => r
85-
.ClientCertificate(this.BadCertificate)
86-
89+
.ClientCertificate(this.Certificate)
8790
)
8891
----
8992

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

-4
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,9 @@ class Precedence
523523
}
524524
----
525525
<1> Even though this property has a NEST property mapping _and_ a `JsonProperty` attribute, We are going to provide a hard rename for it on ConnectionSettings later that should win.
526-
527526
<2> This property has both a NEST attribute and a `JsonProperty`, NEST should win.
528-
529527
<3> We should take the json property into account by itself
530-
531528
<4> This property we are going to special case in our custom serializer to resolve to ask
532-
533529
<5> We are going to register a DefaultFieldNameInferrer on ConnectionSettings that will uppercase all properties.
534530

535531
Here we create a custom serializer that renames any property named `AskSerializer` to `ask`

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

-4
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ ISearchRequest singleTypedRequest = new SearchDescriptor<Project>().Index(single
7979
var invalidSingleString = Index("name1, name2"); <3>
8080
----
8181
<1> specifying a single index using a string
82-
8382
<2> specifying a single index using a type
84-
8583
<3> an **invalid** single index name
8684

8785
==== Specifying multiple indices
@@ -113,9 +111,7 @@ manyStringRequest = new SearchDescriptor<Project>().Type(new[] { "name1", "name2
113111
((IUrlParameter)manyStringRequest.Type).GetString(this.Client.ConnectionSettings).Should().Be("name1,name2");
114112
----
115113
<1> specifying multiple indices using strings
116-
117114
<2> specifying multiple indices using types
118-
119115
<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.
120116

121117
==== Specifying All Indices

docs/client-concepts/low-level/connecting.asciidoc

-8
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ var client = new ElasticLowLevelClient(config);
9191
var result = client.Search<SearchResponse<object>>(new { size = 12 });
9292
----
9393
<1> Disable automatic proxy detection. When called, defaults to `true`.
94-
9594
<2> Enable compressed request and responses from Elasticsearch (Note that nodes need to be configured to allow this. See the {ref_current}/modules-http.html[http module settings] for more info).
96-
9795
<3> By default responses are deserialized directly from the response stream to the object you tell it to. For debugging purposes, it can be very useful to keep a copy of the raw response on the result object, which is what calling this method will do.
9896

9997
`.ResponseBodyInBytes` will only have a value if the client configuration has `DisableDirectStreaming` set
@@ -131,13 +129,9 @@ config = config
131129
.BasicAuthentication("username", "password");
132130
----
133131
<1> Allows you to set querystring parameters that have to be added to every request. For instance, if you use a hosted elasticserch provider, and you need need to pass an `apiKey` parameter onto every request.
134-
135132
<2> Sets proxy information on the connection.
136-
137133
<3> [[request-timeout]] Sets the global maximum time a connection may take. Please note that this is the request timeout, the builtin .NET `WebRequest` has no way to set connection timeouts (see http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.timeout(v=vs.110).aspx[the MSDN documentation on `HttpWebRequest.Timeout` Property]).
138-
139134
<4> As an alternative to the C/go like error checking on `response.IsValid`, you can instead tell the client to <<thrown-exceptions, throw exceptions>>.
140-
141135
<5> forces all serialization to be indented and appends `pretty=true` to all the requests so that the responses are indented as well
142136

143137
NOTE: Basic authentication credentials can alternatively be specified on the node URI directly:
@@ -359,8 +353,6 @@ public class MyJsonNetSerializer : JsonNetSerializer
359353
}
360354
----
361355
<1> Call this constructor if you only need access to `JsonSerializerSettings` without local state (properties on MyJsonNetSerializer)
362-
363356
<2> Call OverwriteDefaultSerializers if you need access to `JsonSerializerSettings` with local state
364-
365357
<3> You can inject contract resolved converters by implementing the ContractConverters property. This can be much faster then registering them on `JsonSerializerSettings.Converters`
366358

docs/query-dsl/joining/parent-id/parent-id-usage.asciidoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ q
2727
.ParentId(p => p
2828
.Name("named_query")
2929
.Type<Developer>()
30-
.Id(Project.Projects.First().Name)
30+
.Id(Project.First.Name)
3131
)
3232
----
3333

@@ -39,7 +39,7 @@ new ParentIdQuery
3939
{
4040
Name = "named_query",
4141
Type = Infer.Type<Developer>(),
42-
Id = Project.Projects.First().Name
42+
Id = Project.First.Name
4343
}
4444
----
4545

docs/search/request/search-after-usage.asciidoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ s => s
2525
.Descending(p => p.Name)
2626
)
2727
.SearchAfter(
28-
Project.Projects.FirstOrDefault().NumberOfCommits,
29-
Project.Projects.FirstOrDefault().Name
28+
Project.First.NumberOfCommits,
29+
Project.First.Name
3030
)
3131
----
3232

@@ -43,8 +43,8 @@ new SearchRequest<Project>
4343
},
4444
SearchAfter = new List<object>
4545
{
46-
Project.Projects.FirstOrDefault().NumberOfCommits,
47-
Project.Projects.FirstOrDefault().Name,
46+
Project.First.NumberOfCommits,
47+
Project.First.Name,
4848
}
4949
}
5050
----
@@ -67,7 +67,7 @@ new SearchRequest<Project>
6767
],
6868
"search_after": [
6969
775,
70-
"Dickinson - Beier"
70+
"Lesch Group"
7171
]
7272
}
7373
----

docs/search/request/suggest-usage.asciidoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ s => s
4242
.Completion("my-completion-suggest", c => c
4343
.Contexts(ctxs => ctxs
4444
.Context("color",
45-
ctx => ctx.Context(Project.Projects.First().Suggest.Contexts.Values.SelectMany(v => v).First())
45+
ctx => ctx.Context(Project.First.Suggest.Contexts.Values.SelectMany(v => v).First())
4646
)
4747
)
4848
.Fuzzy(f => f
@@ -110,7 +110,7 @@ new SearchRequest<Project>
110110
{
111111
Contexts = new Dictionary<string, IList<ISuggestContextQuery>>
112112
{
113-
{ "color", new List<ISuggestContextQuery> { new SuggestContextQuery { Context = Project.Projects.First().Suggest.Contexts.Values.SelectMany(v => v).First() } } }
113+
{ "color", new List<ISuggestContextQuery> { new SuggestContextQuery { Context = Project.First.Suggest.Contexts.Values.SelectMany(v => v).First() } } }
114114
},
115115
Fuzzy = new FuzzySuggester
116116
{
@@ -247,6 +247,6 @@ option.Contexts.Should().NotBeNull().And.NotBeEmpty();
247247
option.Contexts.Should().ContainKey("color");
248248
var colorContexts = option.Contexts["color"];
249249
colorContexts.Should().NotBeNull().And.HaveCount(1);
250-
colorContexts.First().Category.Should().Be((Project.Projects.First().Suggest.Contexts.Values.SelectMany(v => v).First()));
250+
colorContexts.First().Category.Should().Be((Project.First.Suggest.Contexts.Values.SelectMany(v => v).First()));
251251
----
252252

0 commit comments

Comments
 (0)