Skip to content

ESQL: Clarify docs and add csv test for WHERE in STATS#133629

Merged
alex-spies merged 10 commits intoelastic:mainfrom
alex-spies:docs-stats-where-groupby
Feb 23, 2026
Merged

ESQL: Clarify docs and add csv test for WHERE in STATS#133629
alex-spies merged 10 commits intoelastic:mainfrom
alex-spies:docs-stats-where-groupby

Conversation

@alex-spies
Copy link
Copy Markdown
Contributor

No description provided.

@alex-spies alex-spies added >docs General docs changes :Analytics/ES|QL AKA ESQL v9.2.0 labels Aug 27, 2025
Co-authored-by: Bogdan Pintea <sig11@mailbox.org>
@alex-spies alex-spies requested a review from leemthompo August 29, 2025 06:59
@leemthompo
Copy link
Copy Markdown
Member

@alex-spies this seems to have fallen through the cracks, should this get merged? :)

@alex-spies
Copy link
Copy Markdown
Contributor Author

Hey @leemthompo , this is nearly done, but we still need to use the added examples in stats.csv-spec in the appropriate places in the docs. I meant to do this in forever, but got interrupted by higher-prio stuff.

It'd be lovely if you wanted to go and finish this; otherwise, I'll get to it eventually :)

@github-actions
Copy link
Copy Markdown
Contributor

ℹ️ Important: Docs version tagging

👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version.

We use applies_to tags to mark version-specific features and changes.

Expand for a quick overview

When to use applies_to tags:

✅ At the page level to indicate which products/deployments the content applies to (mandatory)
✅ When features change state (e.g. preview, ga) in a specific version
✅ When availability differs across deployments and environments

What NOT to do:

❌ Don't remove or replace information that applies to an older version
❌ Don't add new information that applies to a specific version without an applies_to tag
❌ Don't forget that applies_to tags can be used at the page, section, and inline level

🤔 Need help?

@alex-spies alex-spies marked this pull request as ready for review February 20, 2026 17:59
@alex-spies alex-spies requested a review from a team as a code owner February 20, 2026 17:59
@elasticsearchmachine elasticsearchmachine added Team:Docs Meta label for docs team Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Feb 20, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/core-docs (Team:Docs)

@alex-spies
Copy link
Copy Markdown
Contributor Author

alex-spies commented Feb 20, 2026

Hey @leemthompo , I hooked in the new examples into stats-by.md. This is ready to go from my side, but would appreciate a quick ✔️ from you before merging this :)

- `**syntax**`, `**parameters**`, `**description**` → `## h2` headings
- `### examples` → `## examples`
- `####` subsections promoted to `###`
- `#### naming` renamed to `### omitting column names`
- each example gets a concise `###` heading with a rewritten lead-in that adds context beyond the heading
- `boolean_expressionx` description: tightened prose, equivalence contrast moved to two fenced `esql` blocks
@leemthompo
Copy link
Copy Markdown
Member

leemthompo commented Feb 23, 2026

@alex-spies I pushed a commit to refactor the page a bit because I wanna do this for all our commands to make them more readable so this is a good POC :)

URL preview (will be live soon): https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/133629/reference/query-languages/esql/commands/stats-by

Old page: https://www.elastic.co/docs/reference/query-languages/esql/commands/stats-by

LMKWYT

Copy link
Copy Markdown
Contributor Author

@alex-spies alex-spies left a comment

Choose a reason for hiding this comment

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

Thanks @leemthompo , I think the new format is much better than before.

I have one nit, but we can also merge this as-is.

Let me know what you think and let's get this in :)


Compare this to filtering with `WHERE` before `STATS`, which excludes
non-matching groups entirely:
### WHERE before STATS excludes non-matching groups
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nit: I think the following example is still part of Filter on the grouping key (by contrasting the example above). But this is fine, too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@alex-spies pushed a commit, if you're happy 🚢

@alex-spies
Copy link
Copy Markdown
Contributor Author

Thanks @leemthompo , I'm quite pleased with the result. Thanks for your help!

@alex-spies alex-spies merged commit bd81312 into elastic:main Feb 23, 2026
35 checks passed
@alex-spies alex-spies deleted the docs-stats-where-groupby branch February 23, 2026 18:39
szybia added a commit to szybia/elasticsearch that referenced this pull request Feb 23, 2026
…on-sliced-reindex

* upstream/main: (110 commits)
  Add search task watchdog to log hot threads on slow search (elastic#142746)
  Fix return_intermediate_results query param on get async search results (elastic#142875)
  Mute org.elasticsearch.compute.operator.exchange.BatchDriverTests testSinglePageSingleBatch elastic#142895
  Cancel reindex body always has status (elastic#142766)
  Fix built-in roles sync losing updates (elastic#142433)
  ESQL: Clarify docs and add csv test for WHERE in STATS (elastic#133629)
  Fix and unmute ReindexResumeIT (elastic#142788)
  Fix broken release notes
  Mute org.elasticsearch.benchmark.vector.scorer.VectorScorerOSQBenchmarkTests testSingleScalarVsVectorized {p0=384 p1=4 p2=NIO p3=COSINE} elastic#142883
  ES|QL: fix Generative tests for commands that don't change the output schema (elastic#142864)
  Mute org.elasticsearch.benchmark.vector.scorer.VectorScorerOSQBenchmarkTests testSingleScalarVsVectorized {p0=1024 p1=1 p2=NIO p3=DOT_PRODUCT} elastic#142881
  SQL: Fix QlIllegalArgumentException with non-foldable date range queries (elastic#142386)
  Add more errors to the allowed_errors with github issue links (elastic#142862)
  ESQL: reapply "NDJSON datasource" (elastic#142855)
  Add implementation to update service settings method for Alibaba Cloud Search service (elastic#142738)
  Mute org.elasticsearch.snapshots.SnapshotShutdownIT testStartRemoveNodeButDoNotComplete elastic#142871
  Mute org.elasticsearch.snapshots.SnapshotShutdownIT testDeleteSnapshotWithPausedShardSnapshots elastic#142870
  Mute org.elasticsearch.snapshots.SnapshotShutdownIT testAbortSnapshotWhileRemovingNode elastic#142869
  Mute org.elasticsearch.snapshots.SnapshotShutdownIT testRemoveNodeDuringSnapshot elastic#142868
  ES|QL: Guard exponential_histogram TO_STRING against too large inputs (elastic#140718)
  ...
jdconrad pushed a commit to jdconrad/elasticsearch that referenced this pull request Feb 24, 2026
Co-authored-by: Bogdan Pintea <sig11@mailbox.org>
Co-authored-by: Liam Thompson <leemthompo@gmail.com>
sidosera pushed a commit to sidosera/elasticsearch that referenced this pull request Feb 24, 2026
Co-authored-by: Bogdan Pintea <sig11@mailbox.org>
Co-authored-by: Liam Thompson <leemthompo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL >docs General docs changes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Docs Meta label for docs team v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants