Skip to content

Conversation

@nielsbauman
Copy link
Contributor

If an index is in either logsdb or time_series mode and specifies a non-default @timestamp type mapping (e.g. date_nanos), using the clone, split, or shrink API will result in shards that are unable to initialize/recover due to the following mapping conflict:

Caused by: java.lang.IllegalArgumentException: mapper [@timestamp] cannot be changed from type [date] to [date_nanos]
	at org.elasticsearch.index.mapper.FieldMapper.checkIncomingMergeType(FieldMapper.java:419)
	at org.elasticsearch.index.mapper.FieldMapper.merge(FieldMapper.java:399)
	at org.elasticsearch.index.mapper.FieldMapper.merge(FieldMapper.java:63)
	at org.elasticsearch.index.mapper.ObjectMapper$MergeResult.buildMergedMappers(ObjectMapper.java:738)
	at org.elasticsearch.index.mapper.ObjectMapper$MergeResult.build(ObjectMapper.java:664)
	at org.elasticsearch.index.mapper.RootObjectMapper.merge(RootObjectMapper.java:249)
	at org.elasticsearch.index.mapper.Mapping.merge(Mapping.java:173)
	at org.elasticsearch.index.mapper.MapperService.mergeMappings(MapperService.java:684)
	at org.elasticsearch.index.mapper.MapperService.mergeMappings(MapperService.java:651)
	at org.elasticsearch.index.mapper.MapperService.doMerge(MapperService.java:599)
	at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:584)
	at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:436)
	at org.elasticsearch.index.shard.StoreRecovery.lambda$recoverFromLocalShards$5(StoreRecovery.java:131)

As of #133954, the searchable_snapshot ILM action makes use of the clone API by default - if the index has more than 0 replicas - and will thus also run into this issue.

@nielsbauman nielsbauman added >bug :Data Management/Indices APIs APIs to create and manage indices and templates auto-backport Automatically create backport pull requests when merged branch:9.2 branch:8.19 labels Oct 24, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine
Copy link
Collaborator

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

Comment on lines +2 to +5
summary: Fix mapping conflicts in clone/split/shrink APIs
area: Indices APIs
type: bug
issues: []
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we make changelog more elaborate/descriptive? cc @mattc58

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, and probably needs to be a release highlight since this might warrant a special release. But that can wait until we determine the impact and precise triggering conditions of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, then I'm merging this as-is. We can come back and update the changelog later if we want to.

Copy link
Member

@masseyke masseyke left a comment

Choose a reason for hiding this comment

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

LGTM

@masseyke
Copy link
Member

Niels shared this outside of the ticket but it was very useful. The following will crash a server without this fix if assertions are enabled:

PUT my-source
{
    "settings": {
        "index.mode": "logsdb",
        "index.blocks.write": true,
        "index.number_of_replicas": 1
    },
    "mappings": {
        "properties": {
            "@timestamp": {
                "type": "date_nanos"
            }
        }
    }
}


POST my-source/_clone/my-target?timeout=5s

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

LGTM.

@nielsbauman nielsbauman enabled auto-merge (squash) October 24, 2025 14:24
@nielsbauman nielsbauman merged commit 4a53551 into elastic:main Oct 24, 2025
34 checks passed
@nielsbauman nielsbauman deleted the fix-clone branch October 24, 2025 15:47
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this pull request Oct 24, 2025
If an index is in either `logsdb` or `time_series` mode and specifies a non-default `@timestamp` type mapping (e.g. `date_nanos`), using the clone, split, or shrink API will result in shards that are unable to initialize/recover due to a mapping conflict.
As of elastic#133954, the `searchable_snapshot` ILM action makes use of the clone API by default - if the index has more than `0` replicas - and will thus also run into this issue.
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
9.2
8.19

elasticsearchmachine pushed a commit that referenced this pull request Oct 24, 2025
If an index is in either `logsdb` or `time_series` mode and specifies a non-default `@timestamp` type mapping (e.g. `date_nanos`), using the clone, split, or shrink API will result in shards that are unable to initialize/recover due to a mapping conflict.
As of #133954, the `searchable_snapshot` ILM action makes use of the clone API by default - if the index has more than `0` replicas - and will thus also run into this issue.
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this pull request Oct 25, 2025
If an index is in either `logsdb` or `time_series` mode and specifies a non-default `@timestamp` type mapping (e.g. `date_nanos`), using the clone, split, or shrink API will result in shards that are unable to initialize/recover due to a mapping conflict.
As of elastic#133954, the `searchable_snapshot` ILM action makes use of the clone API by default - if the index has more than `0` replicas - and will thus also run into this issue.
elasticsearchmachine pushed a commit that referenced this pull request Oct 25, 2025
If an index is in either `logsdb` or `time_series` mode and specifies a non-default `@timestamp` type mapping (e.g. `date_nanos`), using the clone, split, or shrink API will result in shards that are unable to initialize/recover due to a mapping conflict.
As of #133954, the `searchable_snapshot` ILM action makes use of the clone API by default - if the index has more than `0` replicas - and will thus also run into this issue.
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this pull request Oct 30, 2025
…le snapshot action

In elastic#133954, we modified ILM's searchable snapshot action to perform the
force-merge on a clone of the index with 0 replicas. This optimization
avoids performing the force-merge redundantly on replicas, as the
subsequent snapshot operation only looks at primary shards.

We've seen some cases where cloning the index resulted in issues; there
was a bug in the clone API that caused shards to be initializing
permanently under specific circumstances (fixed by elastic#137096), and cloned
shards are unable to be assigned if their source lives on a node that is
close/past the low watermark disk threshold (will be fixed soon by the
Distributed Coordination team).

Therefore, we implement an opt-out flag that users can configure in the
`searchable_snapshot` action of their ILM policy if they don't want to
clone the index with 0 replicas before performing the force-merge. We
implement an opt-out instead of an opt-in, as we believe these issues to
be rather specific (and soon resolved), and the clone is worth doing by
default.
nielsbauman added a commit that referenced this pull request Oct 30, 2025
…le snapshot action (#137375)

In #133954, we modified ILM's searchable snapshot action to perform the
force-merge on a clone of the index with 0 replicas. This optimization
avoids performing the force-merge redundantly on replicas, as the
subsequent snapshot operation only looks at primary shards.

We've seen some cases where cloning the index resulted in issues; there
was a bug in the clone API that caused shards to be initializing
permanently under specific circumstances (fixed by #137096), and cloned
shards are unable to be assigned if their source lives on a node that is
close/past the low watermark disk threshold (will be fixed soon by the
Distributed Coordination team).

Therefore, we implement an opt-out flag that users can configure in the
`searchable_snapshot` action of their ILM policy if they don't want to
clone the index with 0 replicas before performing the force-merge. We
implement an opt-out instead of an opt-in, as we believe these issues to
be rather specific (and soon resolved), and the clone is worth doing by
default.
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this pull request Oct 31, 2025
…le snapshot action (elastic#137375)

In elastic#133954, we modified ILM's searchable snapshot action to perform the
force-merge on a clone of the index with 0 replicas. This optimization
avoids performing the force-merge redundantly on replicas, as the
subsequent snapshot operation only looks at primary shards.

We've seen some cases where cloning the index resulted in issues; there
was a bug in the clone API that caused shards to be initializing
permanently under specific circumstances (fixed by elastic#137096), and cloned
shards are unable to be assigned if their source lives on a node that is
close/past the low watermark disk threshold (will be fixed soon by the
Distributed Coordination team).

Therefore, we implement an opt-out flag that users can configure in the
`searchable_snapshot` action of their ILM policy if they don't want to
clone the index with 0 replicas before performing the force-merge. We
implement an opt-out instead of an opt-in, as we believe these issues to
be rather specific (and soon resolved), and the clone is worth doing by
default.

(cherry picked from commit 0ab3240)

# Conflicts:
#	server/src/main/resources/transport/upper_bounds/9.2.csv
#	server/src/main/resources/transport/upper_bounds/9.3.csv
#	x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this pull request Oct 31, 2025
…le snapshot action (elastic#137375)

In elastic#133954, we modified ILM's searchable snapshot action to perform the
force-merge on a clone of the index with 0 replicas. This optimization
avoids performing the force-merge redundantly on replicas, as the
subsequent snapshot operation only looks at primary shards.

We've seen some cases where cloning the index resulted in issues; there
was a bug in the clone API that caused shards to be initializing
permanently under specific circumstances (fixed by elastic#137096), and cloned
shards are unable to be assigned if their source lives on a node that is
close/past the low watermark disk threshold (will be fixed soon by the
Distributed Coordination team).

Therefore, we implement an opt-out flag that users can configure in the
`searchable_snapshot` action of their ILM policy if they don't want to
clone the index with 0 replicas before performing the force-merge. We
implement an opt-out instead of an opt-in, as we believe these issues to
be rather specific (and soon resolved), and the clone is worth doing by
default.

(cherry picked from commit 0ab3240)

# Conflicts:
#	server/src/main/resources/transport/upper_bounds/9.3.csv
#	x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java
elasticsearchmachine pushed a commit that referenced this pull request Oct 31, 2025
…archable snapshot action (#137375) (#137463)

* Allow opting out of force-merging on a cloned index in ILM's searchable snapshot action (#137375)

In #133954, we modified ILM's searchable snapshot action to perform the
force-merge on a clone of the index with 0 replicas. This optimization
avoids performing the force-merge redundantly on replicas, as the
subsequent snapshot operation only looks at primary shards.

We've seen some cases where cloning the index resulted in issues; there
was a bug in the clone API that caused shards to be initializing
permanently under specific circumstances (fixed by #137096), and cloned
shards are unable to be assigned if their source lives on a node that is
close/past the low watermark disk threshold (will be fixed soon by the
Distributed Coordination team).

Therefore, we implement an opt-out flag that users can configure in the
`searchable_snapshot` action of their ILM policy if they don't want to
clone the index with 0 replicas before performing the force-merge. We
implement an opt-out instead of an opt-in, as we believe these issues to
be rather specific (and soon resolved), and the clone is worth doing by
default.

(cherry picked from commit 0ab3240)

# Conflicts:
#	server/src/main/resources/transport/upper_bounds/9.3.csv
#	x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/RestPutLifecycleAction.java

* Fix transport version
fzowl pushed a commit to voyage-ai/elasticsearch that referenced this pull request Nov 3, 2025
If an index is in either `logsdb` or `time_series` mode and specifies a non-default `@timestamp` type mapping (e.g. `date_nanos`), using the clone, split, or shrink API will result in shards that are unable to initialize/recover due to a mapping conflict.
As of elastic#133954, the `searchable_snapshot` ILM action makes use of the clone API by default - if the index has more than `0` replicas - and will thus also run into this issue.
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 >bug :Data Management/Indices APIs APIs to create and manage indices and templates Team:Data Management Meta label for data/management team v8.19.7 v9.2.1 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants