Skip to content

ESQL: Update text formats documentation #2307

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 7 commits into from
Jul 30, 2025
Merged

Conversation

ivancea
Copy link
Contributor

@ivancea ivancea commented Jul 29, 2025

Separated the ESQL endpoint formats docs in 3 blocks: Structured, Tabular and Binary (Open to suggestions for the names here).

Initially, it was only "Human readable" and "Binary". But CSV, TSV and TXT are different from JSON and YAML, as they don't show all the results, only the query results as a table (For example, no "took" or "is_partial" fields).

API specification change: elastic/elasticsearch-specification#5054

@ivancea ivancea added documentation Improvements or additions to documentation v9.2.0 labels Jul 29, 2025
Copy link

github-actions bot commented Jul 29, 2025

🔍 Preview links for changed docs

Comment on lines 68 to 69
In the "Tabular" formats, only the resulting data will be returned. Other response fields will be missing.
Use them when you want a quick view of the results.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads a bit weird to me; looking for suggestions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine with me. And lines up with my feelings about that format. Great for seeing the results in a dense way as a human being. CSV may even be good out of curl too. But "applications" should use json.

@ivancea ivancea requested review from nik9000 and bpintea July 29, 2025 13:41
@ivancea ivancea marked this pull request as ready for review July 29, 2025 13:41
@ivancea ivancea requested review from a team as code owners July 29, 2025 13:41
Comment on lines 68 to 69
In the "Tabular" formats, only the resulting data will be returned. Other response fields will be missing.
Use them when you want a quick view of the results.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine with me. And lines up with my feelings about that format. Great for seeing the results in a dense way as a human being. CSV may even be good out of curl too. But "applications" should use json.

@leemthompo
Copy link
Contributor

@ivancea maybe you just add descriptions of what each category means directly in the table, and cut down on the admonitions:

format HTTP header Description
Structured Complete response with metadata
json application/json JSON with full response structure
yaml application/yaml YAML with full response structure
Tabular Query results only, no metadata
csv text/csv Comma-separated values
tsv text/tab-separated-values Tab-separated values
txt text/plain CLI-like table representation
Binary Compact binary encoding
cbor application/cbor Concise Binary Object Representation
smile application/smile Smile binary format

Copy link

@bpintea bpintea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a suggested change, but LGTM, thanks for adding this.

Copy link
Contributor

@leemthompo leemthompo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great now, and super helpful.

Optional addition suggestion:
I was thinking at the start of this section, we could just have an example of how to set the format in Console after we say You can set the format by specifying the format parameter in the URL or by setting the Accept or Content-Type HTTP header.

For example:

POST /_query?format=txt

| `json` | `application/json` | [JSON](https://www.json.org/) (JavaScript Object Notation) human-readable format |
| `yaml` | `application/yaml` | [YAML](https://en.wikipedia.org/wiki/YAML) (YAML Ain’t Markup Language) human-readable format |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `yaml` | `application/yaml` | [YAML](https://en.wikipedia.org/wiki/YAML) (YAML Ain’t Markup Language) human-readable format |
| `yaml` | `application/yaml` | [YAML](https://en.wikipedia.org/wiki/YAML) human-readable format |

nit: not sure if it's useful to provide the recursive acronym 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't think it adds much, but we have it in every other format, so I'd say to keep it, even if just for normalization and flavor 👀

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing wrong with a bit of flavor 🫡

ivancea added a commit to elastic/elasticsearch-specification that referenced this pull request Jul 29, 2025
Spec docs update for the ESQL `format` parameter. Text formats result in missing metadata in the response body.

Main docs change: elastic/docs-content#2307
github-actions bot pushed a commit to elastic/elasticsearch-specification that referenced this pull request Jul 29, 2025
Spec docs update for the ESQL `format` parameter. Text formats result in missing metadata in the response body.

Main docs change: elastic/docs-content#2307

(cherry picked from commit a04b872)
Copy link
Member

@bmorelli25 bmorelli25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivancea ivancea enabled auto-merge (squash) July 30, 2025 09:24
ivancea added a commit to elastic/elasticsearch-specification that referenced this pull request Jul 30, 2025
Spec docs update for the ESQL `format` parameter. Text formats result in missing metadata in the response body.

Main docs change: elastic/docs-content#2307

(cherry picked from commit a04b872)

Co-authored-by: Iván Cea Fontenla <[email protected]>
@ivancea ivancea merged commit a6551af into main Jul 30, 2025
7 of 8 checks passed
@ivancea ivancea deleted the ivancea-esql-text-formats branch July 30, 2025 09:26
ivancea added a commit to elastic/elasticsearch-specification that referenced this pull request Jul 30, 2025
Spec docs update for the ESQL `format` parameter. Text formats result in missing metadata in the response body.

Main docs change: elastic/docs-content#2307

(cherry picked from commit a04b872)
ivancea added a commit to elastic/elasticsearch-specification that referenced this pull request Jul 30, 2025
Spec docs update for the ESQL `format` parameter. Text formats result in missing metadata in the response body.

Main docs change: elastic/docs-content#2307

(cherry picked from commit a04b872)
ivancea added a commit to elastic/elasticsearch-specification that referenced this pull request Jul 30, 2025
Spec docs update for the ESQL `format` parameter. Text formats result in missing metadata in the response body.

Main docs change: elastic/docs-content#2307

(cherry picked from commit a04b872)
ivancea added a commit to elastic/elasticsearch-specification that referenced this pull request Jul 30, 2025
Spec docs update for the ESQL `format` parameter. Text formats result in missing metadata in the response body.

Main docs change: elastic/docs-content#2307

(cherry picked from commit a04b872)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants