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/client-concepts.asciidoc
+4-4
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,19 @@
1
1
[[client-concepts]]
2
-
==Client concepts
2
+
= Client concepts
3
3
4
-
The high-level .NET client for {es} maps closely to the original {es} API. All
4
+
The .NET client for {es} maps closely to the original {es} API. All
5
5
requests and responses are exposed through types, making it ideal for getting up and running quickly.
6
6
7
7
[[serialization]]
8
-
=== Serialization
8
+
== Serialization
9
9
10
10
By default, the .NET client for {es} uses the Microsoft System.Text.Json library for serialization. The client understands how to serialize and
11
11
deserialize the request and response types correctly. It also handles (de)serialization of user POCO types representing documents read or written to {es}.
12
12
13
13
The client has two distinct serialization responsibilities - serialization of the types owned by the `Elastic.Clients.Elasticsearch` library and serialization of source documents, modeled in application code. The first responsibility is entirely internal; the second is configurable.
14
14
15
15
[[source-serialization]]
16
-
==== Source serialization
16
+
=== Source serialization
17
17
18
18
Source serialization refers to the process of (de)serializing POCO types in consumer applications as source documents indexed and retrieved from {es}. A source serializer implementation handles serialization, with the default implementation using the `System.Text.Json` library. As a result, you may use `System.Text.Json` attributes and converters to control the serialization behavior.
Copy file name to clipboardExpand all lines: docs/client-concepts/serialization/custom-serialization.asciidoc
+9-11
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,21 @@
1
1
[[custom-serialization]]
2
-
=== Custom Serialization
2
+
====Custom serialization
3
3
4
4
The built-in source serializer handles most POCO document models correctly. Sometimes, you may need further control over how your types are serialized.
5
5
6
6
NOTE: The built-in source serializer uses the Microsoft https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/overview[`System.Text.Json` library] internally. You can apply `System.Text.Json` attributes and converters to control serialization of your document types.
7
7
8
8
[[system-text-json-attributes]]
9
-
==== Using System.Text.Json attributes
9
+
===== Using `System.Text.Json` attributes
10
10
11
11
`System.Text.Json` includes attributes that can be applied to types and properties to control how they are serialized. These can be applied to your POCO document types to perform actions such as controlling the name of a property, or ignoring a property entirely. Visit the https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/overview[Microsoft documentation for further examples].
12
12
13
13
We can model a document to represent data about a person using a regular class (POCO), applying `System.Text.Json`` attributes as necessary.
The index request is serialized, with the source serializer handling the `Person` type, serializing the POCO property named `FirstName` to the JSON object member named `forename`. The `Age` property is ignored and does not appear in the JSON.
@@ -40,17 +38,17 @@ The index request is serialized, with the source serializer handling the `Person
0 commit comments