-
Notifications
You must be signed in to change notification settings - Fork 292
[DOCS] Adds the structure of the ES|QL docs #789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1ba3eb3
[DOCS] Adds the structure of the ES|QL docs.
szabosteve 17401e5
[DOCS] Amends structure.
szabosteve c0d67a8
Apply suggestions from code review
szabosteve 65e26d3
Apply suggestions from code review
szabosteve 344b032
Merge branch 'main' into szabosteve/esql-docs-structure
szabosteve 1faa04e
[DOCS] Fine-tunes blueprint content.
szabosteve 42ea5ef
Merge branch 'szabosteve/esql-docs-structure' of github.com:elastic/e…
szabosteve b0a71a9
Merge branch 'main' into szabosteve/esql-docs-structure
szabosteve 2e24a68
Apply suggestions from code review
szabosteve 5c9b91d
Update docs/usage/esql.asciidoc
szabosteve 14046f7
added code examples
l-trotta 0a7737f
removed columnar adapter
l-trotta 5faa9f1
Merge branch 'main' into szabosteve/esql-docs-structure
szabosteve 5106377
[DOCS] Adjusts code block layout.
szabosteve File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| [[esql]] | ||
| === ES|QL in the Java client | ||
|
|
||
| This page enables you to understand and use {ref}/esql.html[ES|QL] in the | ||
| Java client. | ||
|
szabosteve marked this conversation as resolved.
|
||
|
|
||
| There are two ways to use ES|QL in the {java-client): | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
|
|
||
| * by using the Elasticsearch {es-docs}/esql-apis.html[ES|QL API] directly. This | ||
| is the most flexible approach, but also the most complex since you must handle | ||
| results in their raw form. You can also choose the precise format of results, | ||
| such as JSON, CSV or text. | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
| * by using ES|QL mapping helpers. These mappers take care of parsing the raw | ||
| response into something readily usable by the application. Several mappers are | ||
| available that are suited to different use cases such as object mapping, cursor | ||
| traversal of results or dataframes. You can also define your own for specific | ||
| use cases. | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
|
|
||
|
szabosteve marked this conversation as resolved.
|
||
| [discrete] | ||
| [[esql-how-to]] | ||
| ==== How to use the ES|QL API | ||
|
|
||
| The {es-docs}/esql-query-api.html[ES|QL query API] allows you to choose how | ||
| results should be returned. This includes the | ||
| {es-docs}/esql-rest.html#esql-rest-format[response format] such as CSV, text or | ||
| JSON, which can be further fine-tuned with parameters such as column separators | ||
| or locale. | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
|
|
||
| Since the response format varies widely depending on the chosen format, the | ||
| {java-client) as a BinaryData object, which you can then use according to the | ||
| format chosen in the request. | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
|
|
||
| The example below shows how to get ES|QL results as CSV and parse them: | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Code example to be written | ||
|
|
||
|
|
||
| [discrete] | ||
| [[esql-consume-results]] | ||
| ==== Consume ES|QL results | ||
|
|
||
| The previous example showed that while using the raw ES|QL API gives maximum | ||
| flexibility, it is low level and requires quite some work to make use of the | ||
| result data. | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
|
|
||
| To simplify things, we have identified three main ways to represent ES|QL | ||
| results and provide mapping helpers for each of them: | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
|
|
||
| * Objects, where each row in the results is mapped to an object from your | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
| application domain. This is similar to what ORMs (object relational mappers) | ||
| commonly do. | ||
| * Cursors, where you scan the results row by row and access the data using | ||
| column names. This is similar to database access libraries. | ||
| * Dataframes, where results are organized in a column-oriented structure that | ||
| allows efficient processing of column data. | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Code examples to be written for each of them, depending on availability in the language | ||
|
|
||
|
|
||
| [discrete] | ||
| [[esql-custom-mapping]] | ||
| ==== Define your own mapping | ||
|
|
||
| While the mappers provided by the {java-client} cover many use cases, your | ||
| application may require some specific mapping not covered by the provided | ||
| mappers. You can write your own mapper and used it in a similar way as the | ||
| built-in ones. | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
|
|
||
| Note that mappers are meant to provide a more usable representation of ES|QL | ||
| results, and not to process the result data. Data processing should be based on | ||
| the output of a result mapper. | ||
|
szabosteve marked this conversation as resolved.
|
||
|
|
||
| As an example, let's write a mapper that returns a simple column-oriented | ||
| representation of the data: | ||
|
szabosteve marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Code example to be written | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.