Skip to content

Commit 9254713

Browse files
committed
Update documentation
1 parent b4f058f commit 9254713

30 files changed

+160
-39
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
:ref_current: https://www.elastic.co/guide/en/elasticsearch/reference/2.4
2+
3+
:xpack_current: https://www.elastic.co/guide/en/x-pack/2.4
4+
5+
:github: https://github.com/elastic/elasticsearch-net
6+
7+
:nuget: https://www.nuget.org/packages
8+
9+
////
10+
IMPORTANT NOTE
11+
==============
12+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/2.x/src/Tests/Aggregations/AggregationMetaUsageTests.cs.
13+
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
14+
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
15+
////
16+
17+
[[aggregation-metadata]]
18+
=== Aggregation Metadata
19+
20+
Metadata can be provided per aggregation, and will be returned in the aggregation response
21+
22+
==== Fluent DSL example
23+
24+
[source,csharp]
25+
----
26+
s => s
27+
.Size(0)
28+
.Aggregations(a => a
29+
.Min("min_last_activity", m => m
30+
.Field(p => p.LastActivity)
31+
.Meta(d => d
32+
.Add("meta_1", "value_1")
33+
.Add("meta_2", 2)
34+
.Add("meta_3", new { meta_3 = "value_3" })
35+
)
36+
)
37+
)
38+
----
39+
40+
==== Object Initializer syntax example
41+
42+
[source,csharp]
43+
----
44+
new SearchRequest<Project>()
45+
{
46+
Size = 0,
47+
Aggregations = new MinAggregation("min_last_activity", Infer.Field<Project>(p => p.LastActivity))
48+
{
49+
Meta = new Dictionary<string,object>
50+
{
51+
{ "meta_1", "value_1" },
52+
{ "meta_2", 2 },
53+
{ "meta_3", new { meta_3 = "value_3" } }
54+
}
55+
}
56+
}
57+
----
58+
59+
[source,javascript]
60+
.Example json output
61+
----
62+
{
63+
"size": 0,
64+
"aggs": {
65+
"min_last_activity": {
66+
"min": {
67+
"field": "lastActivity"
68+
},
69+
"meta": {
70+
"meta_1": "value_1",
71+
"meta_2": 2,
72+
"meta_3": {
73+
"meta_3": "value_3"
74+
}
75+
}
76+
}
77+
}
78+
}
79+
----
80+
81+
==== Handling Responses
82+
83+
[source,csharp]
84+
----
85+
response.ShouldBeValid();
86+
var min = response.Aggs.Min("min_last_activity");
87+
min.Meta.Should().NotBeNull().And.ContainKeys("meta_1", "meta_2", "meta_3");
88+
----
89+

docs/aggregations/writing-aggregations.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Now that's much cleaner! Assigning an `*Aggregation` type directly to the `Aggre
149149

150150
An advanced scenario may involve an existing collection of aggregation functions that should be set as aggregations
151151
on the request. Using LINQ's `.Aggregate()` method, each function can be applied to the aggregation descriptor
152-
`childAggs` below) in turn, returning the descriptor after each function application.
152+
(`childAggs` below) in turn, returning the descriptor after each function application.
153153

154154
==== Fluent DSL example
155155

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ that generated the certificate is trusted by the machine running the client code
2323
to the cluster over HTTPS with the client.
2424

2525
If you are using your own CA which is not trusted however, .NET won't allow you to make HTTPS calls to that endpoint by default. With .NET,
26-
you can pre-empt this though a custom validation callback on the global static`ServicePointManager.ServerCertificateValidationCallback`. Most examples you will find doing this this will simply return `true` from the
26+
you can pre-empt this though a custom validation callback on the global static
27+
`ServicePointManager.ServerCertificateValidationCallback`. Most examples you will find doing this this will simply return `true` from the
2728
validation callback and merrily whistle off into the sunset. **This is not advisable** as it allows *any* HTTPS traffic through in the
2829
current `AppDomain` *without* any validation. Here's a concrete example:
2930

@@ -41,8 +42,9 @@ validation will not be performed for HTTPS connections to *both* Elasticsearch *
4142
==== Validation configuration
4243

4344
It's possible to also set a callback per service endpoint with .NET, and both Elasticsearch.NET and NEST expose this through
44-
connection settings `ConnectionConfiguration` with Elasticsearch.Net and `ConnectionSettings` with NEST). You can do
45-
your own validation in that handler or use one of the baked in handlers that we ship with out of the box, on the static class`CertificateValidations`.
45+
connection settings (`ConnectionConfiguration` with Elasticsearch.Net and `ConnectionSettings` with NEST). You can do
46+
your own validation in that handler or use one of the baked in handlers that we ship with out of the box, on the static class
47+
`CertificateValidations`.
4648

4749
The two most basic ones are `AllowAll` and `DenyAll`, which accept or deny all SSL traffic to our nodes, respectively. Here's
4850
a couple of examples.
@@ -84,7 +86,8 @@ public class AllowAllCertificatesCluster : ClusterBase
8486
If your client application has access to the public CA certificate locally, Elasticsearch.NET and NEST ship with some handy helpers
8587
that can assert that a certificate the server presents is one that came from the local CA.
8688

87-
Some certificates do not include the CA in the certificate chain, in order to cut down on SSL handshake size. In those case you can use`CertificateValidations.AuthorityIsRoot` and pass it your local copy of the CA public key to assert that
89+
Some certificates do not include the CA in the certificate chain, in order to cut down on SSL handshake size. In those case you can use
90+
`CertificateValidations.AuthorityIsRoot` and pass it your local copy of the CA public key to assert that
8891
the certificate the server presented was generated using it
8992

9093
[source,csharp]
@@ -120,7 +123,7 @@ the local CA certificate is part of the chain that was used to generate the serv
120123
Shield also allows you to configure a PKI realm to enable user authentication
121124
through client certificates.
122125

123-
To authenticate with client certificates, you need to present both a public certificate `.cer`) and a private key `.key`
126+
To authenticate with client certificates, you need to present both a public certificate (`.cer`) and a private key `.key`
124127
as one certificate. The easiest way to do this is to generate a `pfx` or `p12` file from the `.cer` and `.key`
125128
and attach these to requests using `new X509Certificate(pathToPfx)`.
126129

docs/client-concepts/connection-pooling/building-blocks/connection-pooling.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ NEST can use to issue client calls on.
2222

2323
[IMPORTANT]
2424
--
25-
Despite the name, a connection pool in NEST is **not** like connection pooling that you may be familiar with from https://msdn.microsoft.com/en-us/library/bb399543(v=vs.110).aspx[interacting with a database using ADO.Net]; for example,
25+
Despite the name, a connection pool in NEST is **not** like connection pooling that you may be familiar with from
26+
https://msdn.microsoft.com/en-us/library/bb399543(v=vs.110).aspx[interacting with a database using ADO.Net]; for example,
2627
a connection pool in NEST is **not** responsible for managing an underlying pool of TCP connections to Elasticsearch,
2728
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]
2829
and can be controlled by <<servicepoint-behaviour,changing the ServicePoint behaviour>> on `HttpConnection`.

docs/client-concepts/connection-pooling/building-blocks/request-pipelines.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ sniffingPipeline.FirstPoolUsageNeedsSniffing.Should().BeFalse();
103103

104104
==== Wait for first sniff
105105

106-
All threads wait for the sniff on startup to finish, waiting the request timeout period. A https://msdn.microsoft.com/en-us/library/system.threading.semaphoreslim(v=vs.110).aspx[`SemaphoreSlim`]
106+
All threads wait for the sniff on startup to finish, waiting the request timeout period. A
107+
https://msdn.microsoft.com/en-us/library/system.threading.semaphoreslim(v=vs.110).aspx[`SemaphoreSlim`]
107108
is used to block threads until the sniff finishes and waiting threads release the `SemaphoreSlim` appropriately.
108109

109110
We can demonstrate this with the following example. First, let's configure

docs/client-concepts/connection-pooling/sticky/sticky-sniffing-connection-pool.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ We set up a cluster with 4 nodes all having a different rack id
5858
our Sticky Sniffing Connection Pool gives the most weight to rack_2 and rack_11.
5959
We initially only seed nodes `9200-9203` in racks 0 to 3. So we should be sticky on rack_2.
6060
We setup node 9202 to fail after two client calls in which case we sniff and find nodes
61-
`9210-9213` in which case we should become sticky on rack_11.
61+
`9210-9213` in which case we should become sticky on rack_11.
6262

6363
[source,csharp]
6464
----

docs/client-concepts/connection/configuration-options.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ how the clients interact with Elasticsearch.
2424

2525
==== Options on ConnectionConfiguration
2626

27-
The following is a list of available connection configuration options on `ConnectionConfiguration`; since`ConnectionSettings` derives from `ConnectionConfiguration`, these options are available for both
27+
The following is a list of available connection configuration options on `ConnectionConfiguration`; since
28+
`ConnectionSettings` derives from `ConnectionConfiguration`, these options are available for both
2829
Elasticsearch.Net and NEST:
2930

3031
`BasicAuthentication`::

docs/client-concepts/connection/modifying-default-connection.asciidoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ The Desktop CLR implementation using `WebRequest` is the most mature implementat
3131
in production since the beginning of NEST. For this reason, we aren't quite ready to it give up in favour of
3232
a `HttpClient` implementation across all CLR versions.
3333

34-
In addition to production usage, there are also a couple of important toggles that are easy to set against a`ServicePoint` that are not possible to set as yet on `HttpClient`.
34+
In addition to production usage, there are also a couple of important toggles that are easy to set against a
35+
`ServicePoint` that are not possible to set as yet on `HttpClient`.
3536

3637
Finally, another limitation is that `HttpClient` has no synchronous code paths, so supporting these means
3738
doing hacky async patches which definitely need time to bake.
@@ -139,7 +140,8 @@ var settings = new ConnectionSettings(connectionPool, connection);
139140
var client = new ElasticClient(settings);
140141
----
141142

142-
The Connection limit has been increased from the default 80 to much higher and https://en.wikipedia.org/wiki/Nagle's_algorithm[nagling] has been enabled, which is disabled by default in the client.
143+
The Connection limit has been increased from the default 80 to much higher and
144+
https://en.wikipedia.org/wiki/Nagle's_algorithm[nagling] has been enabled, which is disabled by default in the client.
143145

144146
NOTE: The client reuses TCP connections through .NET's internal connection pooling,
145147
so changing the connection limit to something really high should only be done with careful

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ var createIndexResponse = client.CreateIndex("my-index", c => c
7272

7373
==== Configuring a built-in analyzer
7474

75-
Several built-in analyzers can be configured to alter their behaviour. For example, the`standard` analyzer can be configured to support a list of stop words with the stop word token filter
75+
Several built-in analyzers can be configured to alter their behaviour. For example, the
76+
`standard` analyzer can be configured to support a list of stop words with the stop word token filter
7677
it contains.
7778

7879
Configuring a built-in analyzer requires creating an analyzer based on the built-in one
@@ -156,7 +157,9 @@ public class Question
156157
----
157158

158159
Based on our domain knowledge of programming languages, we would like to be able to search questions
159-
that contain `"C#"`, but using the `standard` analyzer, `"C#"` will be analyzed and produce the token`"c"`. This won't work for our use case as there will be no way to distinguish questions about`"C#"` from questions about another popular programming language, `"C"`.
160+
that contain `"C#"`, but using the `standard` analyzer, `"C#"` will be analyzed and produce the token
161+
`"c"`. This won't work for our use case as there will be no way to distinguish questions about
162+
`"C#"` from questions about another popular programming language, `"C"`.
160163

161164
We can solve our issue with a custom analyzer
162165

docs/client-concepts/high-level/covariant-hits/covariant-search-results.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ NEST directly supports returning covariant result sets.
2121
Meaning a result can be typed to an interface or base class
2222
but the actual instance type of the result can be that of the subclass directly
2323

24-
Let's look at an example; Imagine we want to search over multiple types that all implement`ISearchResult`
24+
Let's look at an example; Imagine we want to search over multiple types that all implement
25+
`ISearchResult`
2526

2627
[source,csharp]
2728
----

0 commit comments

Comments
 (0)