Skip to content

[ESQL] Makes LIMIT BY Tech Preview#145225

Merged
ncordon merged 13 commits intoelastic:mainfrom
ncordon:limit-by-tech-preview
Apr 1, 2026
Merged

[ESQL] Makes LIMIT BY Tech Preview#145225
ncordon merged 13 commits intoelastic:mainfrom
ncordon:limit-by-tech-preview

Conversation

@ncordon
Copy link
Copy Markdown
Member

@ncordon ncordon commented Mar 30, 2026

This PR gets the LIMIT BY command out of snapshot and into Tech Preview. Also it adds docs for the new command.

This should be merged after #145115.

Closes #112918, closes https://github.com/elastic/esql-planning/issues/424

@ncordon ncordon added >feature Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) :Analytics/ES|QL AKA ESQL v9.4.0 labels Mar 30, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

- 112918
pr: 145225
summary: Adds LIMIT BY ESQL command in Tech Preview
type: enhancement
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not sure whether I need feature here or whether I need a changelog at all

Copy link
Copy Markdown
Member

@leemthompo leemthompo Apr 1, 2026

Choose a reason for hiding this comment

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

Not sure whether I need feature here

I don't think it matters as features and enhancements get mushed together anyways 😄

https://www.elastic.co/docs/release-notes/elasticsearch#elasticsearch-9.3.2-features-enhancements

@ncordon ncordon added the test-release Trigger CI checks against release build label Mar 31, 2026
@ncordon ncordon requested review from a team as code owners April 1, 2026 00:02
@ncordon ncordon requested review from kc13greiner and removed request for a team and kc13greiner April 1, 2026 00:02
@ncordon ncordon force-pushed the limit-by-tech-preview branch from 5a14f9b to ee40db4 Compare April 1, 2026 00:21
@ncordon ncordon added the >docs General docs changes label Apr 1, 2026
@ncordon
Copy link
Copy Markdown
Member Author

ncordon commented Apr 1, 2026

run docs-build

@ncordon ncordon requested a review from a team April 1, 2026 00:32
@leemthompo
Copy link
Copy Markdown
Member

@ncordon docs eng had to some security work to harden the docs build pipelines, and a side effect is that when working from a fork, we need your profile to be public to verify elastic org membership and then enable automatic previews

You can do that simply by flipping to public here: https://github.com/orgs/elastic/people?query=cordon

The alternative is to build locally: https://www.elastic.co/docs/contribute-docs/locally#install-docs-builder

@ncordon
Copy link
Copy Markdown
Member Author

ncordon commented Apr 1, 2026

You can do that simply by flipping to public here: https://github.com/orgs/elastic/people?query=cordon

Done!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🔍 Preview links for changed docs

⏳ Building and deploying preview... View progress

This comment will be updated with preview links when the build is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

ℹ️ 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?

Copy link
Copy Markdown
Contributor

@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.

Reviewed the technical change, not the docs.

LGTM, thanks @ncordon !


```esql
FROM employees
| SORT salary DESC
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: all examples use a SORT, it seems? Not wrong, though.

Copy link
Copy Markdown
Member Author

@ncordon ncordon Apr 1, 2026

Choose a reason for hiding this comment

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

This is an interesting limitation. With LIMIT BY alone it would be difficult to stabilize the output of the csv tests and I'd have to do artificial things like including a LIMIT between the SORT and LIMIT BY:

FROM employees
| SORT salary DESC
| LIMIT 1000
| LIMIT 1 BY gender
| KEEP first_name, last_name, salary, gender

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What we've done previously is place the tags such that the sort is not included :) a little bit fake, but should work.

But it's just a nit, not a must-have!

@ncordon
Copy link
Copy Markdown
Member Author

ncordon commented Apr 1, 2026

run docs-build

@ncordon ncordon merged commit 03edb6e into elastic:main Apr 1, 2026
32 of 36 checks passed
@ncordon
Copy link
Copy Markdown
Member Author

ncordon commented Apr 1, 2026

I merged the pr. The CI passed, the jobs not reporting are successful but stuck on the reporting back.

I'll address any feedback you leave here separately @leemthompo

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

@ncordon according to this PR's labels, I need to update the changelog YAML, but I can't because the PR is closed. Please either update the changelog yourself on the appropriate branch, or adjust the labels. Specifically:

  • The PR is labelled release highlight but the changelog has no highlight section

mromaios pushed a commit to mromaios/elasticsearch that referenced this pull request Apr 9, 2026
---------

Co-authored-by: Iván Cea Fontenla <ivancea96@outlook.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 >feature release highlight Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) test-release Trigger CI checks against release build v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ESQL] LIMIT BY

5 participants