Skip to content

Fix shadowing ts param in non ts mappings#141549

Merged
elasticsearchmachine merged 13 commits intoelastic:mainfrom
gmarouli:fix-shadowing-ts-param-in-non-ts-mappings
Feb 3, 2026
Merged

Fix shadowing ts param in non ts mappings#141549
elasticsearchmachine merged 13 commits intoelastic:mainfrom
gmarouli:fix-shadowing-ts-param-in-non-ts-mappings

Conversation

@gmarouli
Copy link
Contributor

@gmarouli gmarouli commented Jan 29, 2026

Runtime fields are not allowed to shadow time series metrics and dimensions in a time series index. However, shadowing metrics and dimensions in non time series indices should be valid because they behave like regular fields.

Fixes #140882

@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

@gmarouli gmarouli added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Feb 3, 2026
@@ -598,10 +598,10 @@ public boolean useTimeSeriesDocValuesCodec() {
*/
public static IndexMode fromString(String value) {
return switch (value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use value.toLowerCase to play it safe?

List<ObjectMapper> objectMappers,
List<RuntimeField> runtimeFields
) {
return createMappingLookup(fieldMappers, objectMappers, runtimeFields, randomFrom(IndexMode.values()));
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this will lead to all sorts of failures, e.g. because there's no dimension and no routing path set. Maybe set to standard by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The index mode is not used anywhere else yet apart from shadowing. This is why I did not default to standard, because it's a fail-safe that we are not interfering with anything else. Do you agree that since it shouldn't matter, we can leave it random?

@gmarouli gmarouli removed the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Feb 3, 2026
@gmarouli gmarouli added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Feb 3, 2026
@elasticsearchmachine elasticsearchmachine merged commit e9bd294 into elastic:main Feb 3, 2026
35 checks passed
@gmarouli gmarouli deleted the fix-shadowing-ts-param-in-non-ts-mappings branch February 3, 2026 14:15
gmarouli added a commit to gmarouli/elasticsearch that referenced this pull request Feb 3, 2026
Runtime fields are not allowed to shadow time series metrics and
dimensions in a time series index. However, shadowing metrics and
dimensions in non time series indices should be valid because they
behave like regular fields.

Fixes elastic#140882
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

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

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

elasticsearchmachine pushed a commit that referenced this pull request Feb 3, 2026
Runtime fields are not allowed to shadow time series metrics and
dimensions in a time series index. However, shadowing metrics and
dimensions in non time series indices should be valid because they
behave like regular fields.

Fixes #140882
gmarouli added a commit to gmarouli/elasticsearch that referenced this pull request Feb 4, 2026
Runtime fields are not allowed to shadow time series metrics and
dimensions in a time series index. However, shadowing metrics and
dimensions in non time series indices should be valid because they
behave like regular fields.

Fixes elastic#140882

(cherry picked from commit e9bd294)

# Conflicts:
#	server/src/test/java/org/elasticsearch/search/SearchServiceTests.java
#	server/src/test/java/org/elasticsearch/search/diversification/DiversifyRetrieverBuilderTests.java
gmarouli added a commit to gmarouli/elasticsearch that referenced this pull request Feb 4, 2026
Runtime fields are not allowed to shadow time series metrics and
dimensions in a time series index. However, shadowing metrics and
dimensions in non time series indices should be valid because they
behave like regular fields.

Fixes elastic#140882

(cherry picked from commit e9bd294)

# Conflicts:
#	server/src/test/java/org/elasticsearch/search/SearchServiceTests.java
#	server/src/test/java/org/elasticsearch/search/diversification/DiversifyRetrieverBuilderTests.java
#	x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/DocumentSubsetBitsetCacheTests.java
#	x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/SecurityIndexReaderWrapperIntegrationTests.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/planner/EsPhysicalOperationProvidersTests.java
gmarouli added a commit to gmarouli/elasticsearch that referenced this pull request Feb 4, 2026
Runtime fields are not allowed to shadow time series metrics and
dimensions in a time series index. However, shadowing metrics and
dimensions in non time series indices should be valid because they
behave like regular fields.

Fixes elastic#140882

(cherry picked from commit e9bd294)

# Conflicts:
#	rest-api-spec/build.gradle
#	server/src/main/java/org/elasticsearch/index/IndexFeatures.java
#	server/src/test/java/org/elasticsearch/search/SearchServiceTests.java
#	server/src/test/java/org/elasticsearch/search/diversification/DiversifyRetrieverBuilderTests.java
#	x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/DocumentSubsetBitsetCacheTests.java
#	x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/SecurityIndexReaderWrapperIntegrationTests.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/planner/EsPhysicalOperationProvidersTests.java
@gmarouli
Copy link
Contributor Author

gmarouli commented Feb 4, 2026

💚 All backports created successfully

Status Branch Result
9.2
9.1
8.19

Questions ?

Please refer to the Backport tool documentation

jfreden pushed a commit to jfreden/elasticsearch that referenced this pull request Feb 4, 2026
Runtime fields are not allowed to shadow time series metrics and
dimensions in a time series index. However, shadowing metrics and
dimensions in non time series indices should be valid because they
behave like regular fields.

Fixes elastic#140882
elasticsearchmachine pushed a commit that referenced this pull request Feb 4, 2026
Runtime fields are not allowed to shadow time series metrics and
dimensions in a time series index. However, shadowing metrics and
dimensions in non time series indices should be valid because they
behave like regular fields.

Fixes #140882

(cherry picked from commit e9bd294)

# Conflicts:
#	server/src/test/java/org/elasticsearch/search/SearchServiceTests.java
#	server/src/test/java/org/elasticsearch/search/diversification/DiversifyRetrieverBuilderTests.java
#	x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/DocumentSubsetBitsetCacheTests.java
#	x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/SecurityIndexReaderWrapperIntegrationTests.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/planner/EsPhysicalOperationProvidersTests.java
elasticsearchmachine pushed a commit that referenced this pull request Feb 4, 2026
* Fix shadowing ts param in non ts mappings (#141549)

Runtime fields are not allowed to shadow time series metrics and
dimensions in a time series index. However, shadowing metrics and
dimensions in non time series indices should be valid because they
behave like regular fields.

Fixes #140882

(cherry picked from commit e9bd294)

# Conflicts:
#	rest-api-spec/build.gradle
#	server/src/main/java/org/elasticsearch/index/IndexFeatures.java
#	server/src/test/java/org/elasticsearch/search/SearchServiceTests.java
#	server/src/test/java/org/elasticsearch/search/diversification/DiversifyRetrieverBuilderTests.java
#	x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/DocumentSubsetBitsetCacheTests.java
#	x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/SecurityIndexReaderWrapperIntegrationTests.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/planner/EsPhysicalOperationProvidersTests.java

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
elasticsearchmachine pushed a commit that referenced this pull request Feb 5, 2026
Runtime fields are not allowed to shadow time series metrics and
dimensions in a time series index. However, shadowing metrics and
dimensions in non time series indices should be valid because they
behave like regular fields.

Fixes #140882

(cherry picked from commit e9bd294)

# Conflicts:
#	server/src/test/java/org/elasticsearch/search/SearchServiceTests.java
#	server/src/test/java/org/elasticsearch/search/diversification/DiversifyRetrieverBuilderTests.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >bug :StorageEngine/Mapping The storage related side of mappings Team:StorageEngine v8.19.12 v9.1.11 v9.2.6 v9.3.1 v9.4.0

4 participants