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
Copy file name to clipboardExpand all lines: docs/client-concepts/certificates/working-with-certificates.asciidoc
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ public class AllowAllCertificatesCluster : SslAndKpiXPackCluster
80
80
If your client application has access to the public CA certificate locally, Elasticsearch.NET and NEST ship with some handy helpers
81
81
that can assert that a certificate the server presents is one that came from the local CA.
82
82
83
-
If you use X-Pack's {ref_current}/certutil.html[+certutil+ tool] to generate SSL certificates, the generated node certificate
83
+
If you use X-Pack's {ref_current}/certutil.html`certutil` tool] to generate SSL certificates, the generated node certificate
84
84
does 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
85
85
the certificate the server presented was generated using it
86
86
@@ -115,7 +115,7 @@ the local CA certificate is part of the chain that was used to generate the serv
115
115
==== Client Certificates
116
116
117
117
X-Pack also allows you to configure a {xpack_current}/pki-realm.html[PKI realm] to enable user authentication
118
-
through client certificates. The {ref_current}/certutil.html[+certutil+ tool] included with X-Pack allows you to
118
+
through client certificates. The {ref_current}/certutil.html`certutil` tool] included with X-Pack allows you to
119
119
generate client certificates as well and assign the distinguished name (DN) of the
@@ -54,17 +54,20 @@ for the base class and then call AutoMap foreach of the types we want it it the
54
54
55
55
[source,csharp]
56
56
----
57
-
var descriptor = new CreateIndexDescriptor("myindex")
57
+
var createIndexResponse = client.CreateIndex("myindex", c => c
58
58
.Mappings(ms => ms
59
59
.Map<Document>(m => m
60
60
.AutoMap<Company>() <1>
61
-
.AutoMap<Employee>() <2>
61
+
.AutoMap(typeof(Employee)) <2>
62
62
)
63
-
);
63
+
)
64
+
);
64
65
----
65
-
<1> Auto map `Company`
66
+
<1> Auto map `Company` using the generic method
67
+
68
+
<2> Auto map `Employee` using the non-generic method
66
69
67
-
<2> Auto map `Employee`
70
+
This produces the following JSON request
68
71
69
72
[source,javascript]
70
73
----
@@ -153,47 +156,47 @@ public class ParentWithStringId : IgnoringProperties.Parent
153
156
public new string Id { get; set; }
154
157
}
155
158
156
-
var descriptor = new CreateIndexDescriptor("myindex")
157
-
.Mappings(ms => ms
158
-
.Map<ParentWithStringId>(m => m
159
-
.AutoMap()
160
-
)
161
-
);
162
-
163
-
var expected = new
164
-
{
165
-
mappings = new
166
-
{
167
-
parent = new
168
-
{
169
-
properties = new
170
-
{
171
-
id = new
172
-
{
173
-
type = "text",
174
-
fields = new
175
-
{
176
-
keyword = new
177
-
{
178
-
ignore_above = 256,
179
-
type = "keyword"
180
-
}
181
-
}
182
-
}
183
-
}
184
-
}
185
-
}
186
-
};
187
-
188
-
var settings = WithConnectionSettings(s => s
159
+
var connectionSettings = new ConnectionSettings(new InMemoryConnection()) <1>
160
+
.DisableDirectStreaming() <2>
189
161
.DefaultMappingFor<ParentWithStringId>(m => m
190
162
.TypeName("parent")
191
163
.Ignore(p => p.Description)
192
164
.Ignore(p => p.IgnoreMe)
165
+
);
166
+
167
+
var client = new ElasticClient(connectionSettings);
168
+
169
+
var createIndexResponse = client.CreateIndex("myindex", c => c
170
+
.Mappings(ms => ms
171
+
.Map<ParentWithStringId>(m => m
172
+
.AutoMap()
173
+
)
193
174
)
194
175
);
176
+
----
177
+
<1> we're using an _in memory_ connection for this example. In your production application though, you'll want to use an `IConnection` that actually sends a request.
178
+
179
+
<2> we disable direct streaming here to capture the request and response bytes. In your production application however, you'll likely not want to do this, since it causes the request and response bytes to be buffered in memory.
0 commit comments