Closed
Description
Elasticsearch Version
main
Installed Plugins
No response
Java Version
bundled
OS Version
macOS Catalina
Problem Description
When using subobjects: false in a component template and adding a field into the same object via dotted field name, an error is thrown even though valid mappings can be built and are built correctly when using two separate component templates
Steps to Reproduce
PUT _component_template/broken_template
{
"template": {
"mappings": {
"properties": {
"foo": {
"type": "object",
"subobjects": false
},
"foo.bar": {
"type": "keyword"
}
}
}
}
fails with the [subobjects] parameter can't be updated for the object mapping [foo]
.
However, defining foo and foo.bar in the exact same way in two component templates works correctly:
PUT _component_template/working_template1
{
"template": {
"mappings": {
"properties": {
"foo": {
"type": "object",
"subobjects": false
}
}
}
}
}
PUT _component_template/working_template2
{
"template": {
"mappings": {
"properties": {
"foo.bar": {
"type": "keyword"
}
}
}
}
}
PUT _index_template/working_match
{
"index_patterns": ["mytest"],
"priority": 1000,
"composed_of": [
"working_template1",
"working_template2"
]
}
PUT mytest
GET mytest
After this mytest
has the mappings:
"mappings": {
"properties": {
"foo": {
"subobjects": false,
"properties": {
"bar": {
"type": "keyword"
}
}
}
}
}
I would expect the broken_template
from above to result in the same mapping instead of failing with an error.
Logs (if relevant)
No response