@@ -13,13 +13,10 @@ There are two ways to use ES|QL in the .NET client:
13
13
is the most flexible approach, but it's also the most complex because you must handle
14
14
results in their raw form. You can choose the precise format of results,
15
15
such as JSON, CSV, or text.
16
- * Use ES|QL mapping helpers: These mappers take care of parsing the raw
17
- response into something readily usable by the application. Several mappers are
16
+ * Use ES|QL high level helpers: These helpers take care of parsing the raw
17
+ response into something readily usable by the application. Several helpers are
18
18
available for different use cases, such as object mapping, cursor
19
- traversal of results, and dataframes. You can also define your own mapper for specific
20
- use cases.
21
-
22
-
19
+ traversal of results (WiP), and dataframes (WiP).
23
20
24
21
[discrete]
25
22
[[esql-how-to]]
@@ -31,12 +28,16 @@ results should be returned. You can choose a
31
28
JSON, then fine-tune it with parameters like column separators
32
29
and locale.
33
30
34
- // Add any .NET-specific usage notes
35
-
36
31
The following example gets ES|QL results as CSV and parses them:
37
32
38
- // Code example to be written
39
-
33
+ [source,charp]
34
+ ----
35
+ var response = await client.Esql.QueryAsync(r => r
36
+ .Query("FROM index")
37
+ .Format("csv")
38
+ );
39
+ var csvContents = Encoding.UTF8.GetString(response.Data);
40
+ ----
40
41
41
42
[discrete]
42
43
[[esql-consume-results]]
@@ -57,23 +58,12 @@ column names. This is similar to database access libraries.
57
58
* **Dataframes**, where results are organized in a column-oriented structure that
58
59
allows efficient processing of column data.
59
60
60
- // Code examples to be written for each of them, depending on availability in the language
61
-
62
-
63
- [discrete]
64
- [[esql-custom-mapping]]
65
- === Define your own mapping
66
-
67
- Although the mappers provided by the .NET client cover many use cases, your
68
- application might require a custom mapping.
69
- You can write your own mapper and use it in a similar way as the
70
- built-in ones.
71
-
72
- Note that mappers are meant to provide a more usable representation of ES|QL
73
- results—not to process the result data. Data processing should be based on
74
- the output of a result mapper.
75
-
76
- Here's an example mapper that returns a simple column-oriented
77
- representation of the data:
78
-
79
- // Code example to be written
61
+ [source,charp]
62
+ ----
63
+ // ObjectAPI example
64
+ var response = await client.Esql.QueryAsObjectsAsync<Person>(x => x.Query("FROM index"));
65
+ foreach (var person in response)
66
+ {
67
+ // ...
68
+ }
69
+ ----
0 commit comments