ESQL: Introduce TimestampAware interface/contract #136772
Copy link
Copy link
Closed
Labels
:Analytics/ES|QLAKA ESQLAKA ESQL:StorageEngine/ES|QLTimeseries / metrics / logsdb capabilities in ES|QLTimeseries / metrics / logsdb capabilities in ES|QL>enhancementTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)Meta label for analytical engine team (ESQL/Aggs/Geo)Team:StorageEngine
Description
Activity
- added:Analytics/ES|QLAKA ESQLAKA ESQL:StorageEngine/ES|QLTimeseries / metrics / logsdb capabilities in ES|QLTimeseries / metrics / logsdb capabilities in ES|QL
on Oct 17, 2025 - addedTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)Meta label for analytical engine team (ESQL/Aggs/Geo)
on Oct 17, 2025 elasticsearchmachine commented
on Oct 17, 2025 CollaboratorMore actionsPinging @elastic/es-analytical-engine (Team:Analytics)
elasticsearchmachine commented
on Oct 17, 2025 CollaboratorMore actionsPinging @elastic/es-storage-engine (Team:StorageEngine)
We could also consider a special
Attributesubclass,UnresolvedTimestamp, and have the analyzer try to resolve this against the index' unique@timestampattribute, if present, even if it had undergone renaming.- added a commit that references this issue
on Oct 24, 2025 - added a commit that references this issue
on Oct 28, 2025 - added a commit that references this issue
on Nov 3, 2025
Metadata
Metadata
Assignees
Labels
:Analytics/ES|QLAKA ESQLAKA ESQL:StorageEngine/ES|QLTimeseries / metrics / logsdb capabilities in ES|QLTimeseries / metrics / logsdb capabilities in ES|QL>enhancementTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)Meta label for analytical engine team (ESQL/Aggs/Geo)Team:StorageEngine
Description
Timeseries related functions require access to the timestamp field (typically
@timestamp). Currently, the functions declare aUnresolvedAttribute(@timestamp)inside their constructor:so that the
Analyzerinjects it however this has several disadvantages:ts indices-* | rename x = @timestamp | ...An improved approach is to be explicit about the dependency and instruct the planner to deal with across the entire query in a holistic fashion.
One approach is to introduce a dedicated
TimestampAwareBuilder(similar toConfigurationAware) to handle the constructor reference or simply rely on theTimestampAwareinterface to mark the consumer and (potentially a (aTimestampSourcefor the provider to clearly indicate the@timestampeither through a dedicated method or through its type/"flag" similar to MetadataAttribute but not by name since it's an actual user facing field).In the function registry define
An alternative to
TimestampAwareBuilderis to check if the target function implementsTimestampAwareinterface and if so, look at the constructor field of time Expression based on the@Paramannotation information. The former should be more reliable since it applies to all constructors whereas@Paramis used for documentation purposes.The advantage of this approach is the resolution and supplying of the timestamp is externalized from the function into the registry which can wire the field directly similar to the approach taken with
Configuration.It's up to the instantiators of the function to supply the timestamp instead of the function itself, the current situation.