Skip to content

Commit 455fc67

Browse files
authored
Update ESQL document
1 parent 350aa67 commit 455fc67

File tree

1 file changed

+20
-30
lines changed

1 file changed

+20
-30
lines changed

docs/usage/esql.asciidoc

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ There are two ways to use ES|QL in the .NET client:
1313
is the most flexible approach, but it's also the most complex because you must handle
1414
results in their raw form. You can choose the precise format of results,
1515
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
1818
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).
2320

2421
[discrete]
2522
[[esql-how-to]]
@@ -31,12 +28,16 @@ results should be returned. You can choose a
3128
JSON, then fine-tune it with parameters like column separators
3229
and locale.
3330

34-
// Add any .NET-specific usage notes
35-
3631
The following example gets ES|QL results as CSV and parses them:
3732

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+
----
4041

4142
[discrete]
4243
[[esql-consume-results]]
@@ -57,23 +58,12 @@ column names. This is similar to database access libraries.
5758
* **Dataframes**, where results are organized in a column-oriented structure that
5859
allows efficient processing of column data.
5960

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

Comments
 (0)