Skip to content

Conversation

leontyevdv
Copy link
Contributor

Add _tsid into the list of available attributes in metadata.

Closes #133205

Add _tsid into the list of available attributes in metadata.

Closes elastic#133205
Copy link
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?

elasticsearchmachine and others added 6 commits September 22, 2025 15:35
Add _tsid into the list of available attributes in metadata.

Closes elastic#133205
…ata-list' into feature/esql-add-tsid-into-metadata-list

# Conflicts:
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/action/EsqlQueryResponseTests.java
Add _tsid into the list of available attributes in metadata.

Closes elastic#133205
…ata-list' into feature/esql-add-tsid-into-metadata-list
@leontyevdv leontyevdv added >enhancement :StorageEngine/TSDB You know, for Metrics :StorageEngine/ES|QL Timeseries / metrics / logsdb capabilities in ES|QL Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:StorageEngine :Analytics/ES|QL AKA ESQL labels Sep 23, 2025
@leontyevdv leontyevdv marked this pull request as ready for review September 23, 2025 14:13
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

@Param(
name = "field",
type = { "boolean", "date", "date_nanos", "double", "integer", "ip", "keyword", "long", "text", "version" }
type = { "boolean", "date", "date_nanos", "double", "integer", "ip", "keyword", "long", "text", "version", "_tsid" }
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need this, is it required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, to use it in CountDistinct. This class is an implementation of TimeSeriesAggregateFunction that creates an instance of CountDistinct here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought it's the other way round, CountDistinctOverTime is built on top of CountDistinct.

CountDistinctOverTime is expected to return 1 per time-series so it's not that useful.. Then again, it doesn't hurt.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kkrik-es , you are right, we can avoid this change. It was there due to the tests for both CountDistinct and CountDistinctOverTime use the same list of parameters. I split them and removed the _tsid data type from CountDistinctOverTime. Thanks!

Copy link
Contributor Author

@leontyevdv leontyevdv Sep 26, 2025

Choose a reason for hiding this comment

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

I also added CrossClusterTimeSeriesIT.

);
return isType(
field(),
dt -> (dt.isNumeric() && dt != DataType.UNSIGNED_LONG) || dt == DataType.TSID_DATA_TYPE,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here, it looks weird to me, @dnhatn , but I didn't find the better way to do it. We use LastOverTime substitution in the TranslateTimeSeriesAggregate and I had to add the type into the function. Wdyt?

elasticsearchmachine and others added 3 commits September 23, 2025 14:26
@dnhatn
Copy link
Member

dnhatn commented Sep 25, 2025

Thanks, Dima! The changes look good to me. I'd like to re-discuss the purpose of exposing this with Kostas. Once we expose it, it will be hard to remove, especially since we're considering a different format for _tsid. Another interesting point is that _tsid seems to work better with FROM than with TS.

# Conflicts:
#	server/src/main/resources/transport/upper_bounds/9.2.csv
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
Copy link
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.

I discussed this with Kostas. We agreed to expose the _tsid, but to keep the scope limited. We also prefer not to document this, as it is intended for internal or debugging purposes. LGTM, thanks Dima!

# Conflicts:
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
Add cross-cluster IT. Improve UT.

Closes elastic#133205
@leontyevdv leontyevdv requested a review from kkrik-es September 26, 2025 08:33
@kkrik-es
Copy link
Contributor

The changes still show up in the md files, is it possible to avoid this?

# Conflicts:
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/LastOverTime.java
# Conflicts:
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
@leontyevdv
Copy link
Contributor Author

The changes still show up in the md files, is it possible to avoid this?

@kkrik-es Done! We still need the _tsid in the functions but I excluded mentions of the data type from the documentation. See https://github.com/elastic/elasticsearch/pull/135204/files#diff-5b3a7bcaf3f57ee42ca359ddd440590dae3f4ddb24071a7587659ef6ad941fe3R1058

@kkrik-es
Copy link
Contributor

Neat! I'll let Nhat stamp, this is good stuff.

Copy link
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.

Thanks for removing the docs! Great work, Dima!

@leontyevdv leontyevdv merged commit f15018c into elastic:main Sep 29, 2025
31 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >enhancement :StorageEngine/ES|QL Timeseries / metrics / logsdb capabilities in ES|QL :StorageEngine/TSDB You know, for Metrics Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:StorageEngine v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add _tsid to the list of available metadata fields
4 participants