Skip to content

Expose _tier metadata attribute in ESQL#139894

Merged
idegtiarenko merged 12 commits intoelastic:mainfrom
idegtiarenko:support_tier_in_esql
Jan 7, 2026
Merged

Expose _tier metadata attribute in ESQL#139894
idegtiarenko merged 12 commits intoelastic:mainfrom
idegtiarenko:support_tier_in_esql

Conversation

@idegtiarenko
Copy link
Copy Markdown
Contributor

@idegtiarenko idegtiarenko commented Dec 22, 2025

This change exposes _tier as an metadata attribute in ESQL.

Same as _search attribute emits top index tier preference, not current tier (in case if index is still relocating).
This attribute may be used in filter conditions, but as for today this will not automatically eliminate entire index during can match phase resulted condition is pushed into underlying QueryBuilder.

Related to #108264

@idegtiarenko idegtiarenko requested a review from nik9000 December 22, 2025 14:39
@idegtiarenko idegtiarenko added >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) :Analytics/ES|QL AKA ESQL v9.3.0 labels Dec 22, 2025
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

Code looks right to me.

@idegtiarenko idegtiarenko added auto-backport Automatically create backport pull requests when merged v9.3.1 v8.19.10 and removed v9.3.0 labels Dec 22, 2025
@idegtiarenko idegtiarenko marked this pull request as ready for review December 22, 2025 15:20
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 22, 2025

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


public void testMetadataFieldUnsupportedPrimitiveType() {
expectError("from test metadata _tier", "line 1:20: unsupported metadata field [_tier]");
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This verifies the error is the same as below but for a different attribute.
It is safe to remove.

# Conflicts:
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
Copy link
Copy Markdown
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

For a followup I think:

We should have an integration test that proves that we filter out the index dispatch. I think Stas wrote one, but I don't know what it's called.

And maybe also one that proves that filters get pushed to the underlying index as MatchAll/MatchNone - maybe in PushQueriesIT or something.

I think both of these tests are fairly important, especially because the pushing process is fairly magical. And because the index dispatch bit is, like, a big hammer that we'd like to make sure works consistently. So a paranoid integration test all the way on the outside seems called for.


_index:keyword
employees
;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we have this test above, right?

@nik9000
Copy link
Copy Markdown
Member

nik9000 commented Jan 7, 2026

Thanks for adding the stuff to CanMatchIT. I hadn't realized it was there. But I'm happy we have it.

@idegtiarenko idegtiarenko merged commit 272ca11 into elastic:main Jan 7, 2026
35 checks passed
@idegtiarenko idegtiarenko deleted the support_tier_in_esql branch January 7, 2026 15:05
@idegtiarenko idegtiarenko changed the title Expose _tier in ESQL Expose _tier metadata attribute in ESQL Jan 7, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

💔 Backport failed

Status Branch Result
8.19 Commit could not be cherrypicked due to conflicts
9.3 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 139894

rjernst pushed a commit to rjernst/elasticsearch that referenced this pull request Jan 7, 2026
idegtiarenko added a commit to idegtiarenko/elasticsearch that referenced this pull request Jan 7, 2026
elasticsearchmachine pushed a commit that referenced this pull request Jan 7, 2026
elasticsearchmachine pushed a commit that referenced this pull request Jan 7, 2026
(cherry picked from commit 272ca11)

# Conflicts:
#	docs/reference/query-languages/esql/esql-metadata-fields.md
#	x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/MetadataAttribute.java
#	x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/plugin/CanMatchIT.java
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/planner/TestPhysicalOperationProviders.java
szybia added a commit to szybia/elasticsearch that referenced this pull request Jan 7, 2026
* upstream/main:
  Add hook for blocking termination (elastic#133555)
  Delegate to ES93ScalarQuantizedVectorsFormat rather than copying behaviour (elastic#139834)
  Refactor compound block types (elastic#140219)
  Flush the rate buffer when the slice index changes (elastic#138856)
  Log linked project connection errors at debug during shutdown (elastic#140239)
  Periodic FIPS 140-3 buildkite pipelines (elastic#139909)
  ES|QL - Remove TERM function (elastic#139953)
  Fix name of started time field in shutdown status (elastic#139910)
  Drop `project_routing` from query params (elastic#140272)
  Fix flaky test: AllocationDecidersTests (elastic#140271)
  Add List Reindex API (elastic#140184)
  Expose _tier metadata attribute in ESQL (elastic#139894)
  Tweak TSDBRestEsqlIT#testTimeSeriesQuerying(...) (elastic#140210)
  Fix an OOM error when creating to many chained synonym graph token filter. (elastic#140026)
  Suppress Azure SDK error logs (elastic#139730)
  Rewritten integer sorts need to use SortedNumericSortField (elastic#139538) (elastic#139700)
  Adjust index versions for skippers for time series (elastic#139670)
  Fix host.name skippers index version range (elastic#139636)
  Remove BWC shim for a broken commit
  Fix index.mapping.use_doc_values_skipper defaults in serverless (elastic#139532)
sidosera pushed a commit to sidosera/elasticsearch that referenced this pull request Jan 7, 2026
idegtiarenko added a commit that referenced this pull request Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants