Skip to content

Support target bucket count in TBUCKET with explicit from/to date range#142747

Merged
felixbarny merged 10 commits intoelastic:mainfrom
felixbarny:tbucket-from-to
Mar 11, 2026
Merged

Support target bucket count in TBUCKET with explicit from/to date range#142747
felixbarny merged 10 commits intoelastic:mainfrom
felixbarny:tbucket-from-to

Conversation

@felixbarny
Copy link
Copy Markdown
Member

@felixbarny felixbarny commented Feb 20, 2026

Allow TBUCKET to accept either a temporal interval or a target bucket count with explicit from/to bounds, and add docs/spec coverage for the new signatures.

Right now, the TBUCKET function isn't really usable in Kibana as it expects a fixed bucket size. In order for it to be adopted in real dashboards, it needs to adapt the number of buckets depending on the selected time range in the date picker.

Example:

TBUCKET(100, ?_tstart, ?_tend)

I'm planning to follow this up by automatically inferring start/end from the query dsl filter. This is similar to how we did it for the PROMQL command. See #142580.

cc @miguel-sanchez-elastic

Allow TBUCKET to accept either a temporal interval or a target bucket
count with explicit from/to bounds, and add docs/spec coverage for the
new signatures.
@felixbarny felixbarny requested a review from kkrik-es February 20, 2026 10:43
@felixbarny felixbarny self-assigned this Feb 20, 2026
@felixbarny felixbarny requested a review from a team as a code owner February 20, 2026 10:43
@felixbarny felixbarny added >enhancement :StorageEngine/ES|QL Timeseries / metrics / PromQL / logsdb capabilities in ES|QL labels Feb 20, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@elasticsearchmachine elasticsearchmachine added Team:StorageEngine v9.4.0 external-contributor Pull request authored by a developer outside the Elasticsearch team labels Feb 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 20, 2026

🔍 Preview links for changed docs

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

Copy link
Copy Markdown
Member

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

Couple comments re. making sure we version tag new info and use lists where possible so it's obvious what's available in specific versions :)

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @felixbarny, I've created a changelog YAML for you.

@felixbarny felixbarny requested a review from kkrik-es March 6, 2026 10:42
@kkrik-es kkrik-es requested a review from dnhatn March 6, 2026 15:26
Copy link
Copy Markdown
Member

@kkrik-es kkrik-es left a comment

Choose a reason for hiding this comment

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

I'll let Nhat approve since this generic esql functionality.

Copy link
Copy Markdown
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

Two small comments, but LGTM. Thanks Felix!

@felixbarny felixbarny enabled auto-merge (squash) March 11, 2026 07:34
@felixbarny felixbarny merged commit 017893f into elastic:main Mar 11, 2026
36 checks passed
szybia added a commit to szybia/elasticsearch that referenced this pull request Mar 11, 2026
…elocations

* upstream/main: (54 commits)
  [ES|QL|DS] Wire parallel parsing into production for text formats (elastic#143997)
  ESQL: Allow EXTERNAL commands be run part of the CsvTests suite (elastic#143970)
  [ESQL] Push stats to external source via metadata (elastic#143940)
  Mute org.elasticsearch.xpack.esql.CsvIT test {csv-spec:approximation.Approximate stats with stats where} elastic#144051
  Refactored SortedNumericDocValuesSyntheticFieldLoader into a Layer (elastic#143912)
  Enable extended doc_values params feature flag in RandomizedRollingUpgradeIT (elastic#143918)
  Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {csv-spec:approximation.Approximate stats with sample} elastic#144022
  Ensure we use float values for rolling upgrade float vectors (elastic#144032)
  Remove sensitive info from reindex task description (elastic#143635)
  Fix HistogramUnionState.equals (elastic#143990)
  Use dedicated IndexRouting API in ShardSplittingQuery (elastic#143776)
  Engine/Store DistributedArchitectureGuide doc (elastic#143818)
  Mute org.elasticsearch.snapshots.ConcurrentSnapshotsIT testDeletesAreBatched elastic#144034
  Avoid serializing exceptions as JSON in remote write endpoint (elastic#143987)
  allow testLoadDocSequenceReturnsCorrectResultsText to circuit break, it happens in serverless occasionally (elastic#144023)
  [ESQL] Adds memory accounting to GroupedLimitOperator (elastic#143941)
  Adjust ESIntegTestCase.getLiveDocs method to account for pruned sequence numbers (elastic#143999)
  Support target bucket count in `TBUCKET` with explicit from/to date range (elastic#142747)
  TSDBDocValuesFormatSingleNodeTests with and without synthetic id (elastic#144002)
  Fix circuit breaker leak in BreakingTDigestHolder (elastic#143873)
  ...
@felixbarny felixbarny mentioned this pull request Mar 19, 2026
michalborek pushed a commit to michalborek/elasticsearch that referenced this pull request Mar 23, 2026
…ange (elastic#142747)

Allow TBUCKET to accept either a temporal interval or a target bucket
count with explicit from/to bounds, and add docs/spec coverage for the
new signatures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement external-contributor Pull request authored by a developer outside the Elasticsearch team :StorageEngine/ES|QL Timeseries / metrics / PromQL / logsdb capabilities in ES|QL Team:StorageEngine v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants