PromQL: add support for implicit range selectors #142557
Merged
felixbarny merged 11 commits intoelastic:mainfrom Feb 18, 2026
Merged
PromQL: add support for implicit range selectors #142557felixbarny merged 11 commits intoelastic:mainfrom
felixbarny merged 11 commits intoelastic:mainfrom
Conversation
For example, `rate(metric)` is interpreted as `rate(metric[step])`
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
kkrik-es
reviewed
Feb 16, 2026
...a/org/elasticsearch/xpack/esql/optimizer/rules/logical/promql/TranslatePromqlToEsqlPlan.java
Show resolved
Hide resolved
… into promql-default-range-vector
kkrik-es
reviewed
Feb 17, 2026
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/core/tree/NodeInfo.java
Show resolved
Hide resolved
kkrik-es
approved these changes
Feb 17, 2026
Member
Author
|
@stratoula fyi: this will add a |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds implicit range selector support for PromQL range-vector functions and extends that behavior with a configurable
scrape_intervalparameter.Queries like
rate(metric)are now supported by internally rewriting selector arguments to an implicit range selector and resolving the concrete window during PromQL-to-ESQL translation.It adds
scrape_intervalas aPROMQLcommand parameter with a default of1mand positive-duration validation, and resolves implicit windows usingwindow = max(step, scrape_interval).The user impact is that PromQL queries in ES|QL are easier to run without hand-tuning every range selector, especially in Kibana where users frequently switch between different date ranges. This makes dashboards and ad-hoc analysis more resilient as the selected time window changes. A planned follow-up (edit: #142580) will automatically determine
stepfrom the selected time range, which makes queries more adaptive to the selected time range and further reduces the need for manual tuning.Non-selector instant vectors remain rejected where a range vector is required, for example
rate(avg(foo)).