-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Closed
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field types:StorageEngine/MappingThe storage related side of mappingsThe storage related side of mappings>bugTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in ElasticsearchTeam:StorageEngine
Description
Elasticsearch Version
8.16
Installed Plugins
No response
Java Version
bundled
OS Version
x
Problem Description
When copy_to
values are parsed, we create a custom context via createCopyToContext
. This context preserves the dynamic
value from parent context which is wrong. That value is for the field that is a source of the copy, not the destination. As a result, when copy_to
destination is a dynamically mapped field and
elasticsearch/server/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java
Line 533 in 45306a5
ensureNotStrict(context, currentFieldName); |
Steps to Reproduce
PUT my-index
{
"mappings": {
"properties": {
"copy_source": {
"dynamic": "strict",
"properties": {
"k": {
"type": "keyword",
"copy_to": "dest"
}
}
}
}
}
}
POST my-index/_bulk?refresh
{ "create": {} }
{ "copy_source": { "k": "let's copy" } }
// Results in this which is wrong
"error": {
"type": "strict_dynamic_mapping_exception",
"reason": "[1:25] mapping set to strict, dynamic introduction of [dest] within [_doc] is not allowed"
}
Logs (if relevant)
No response
Metadata
Metadata
Assignees
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field types:StorageEngine/MappingThe storage related side of mappingsThe storage related side of mappings>bugTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in ElasticsearchTeam:StorageEngine