Skip to content

Commit 19b184d

Browse files
authored
Update logstash-management.json to use typeless template (#38653)
This commit changes the type from "doc" to "_doc" for the .logstash-management template. Since this is an internally managed template it does not always go through the REST layer for it's internal representation. The internal representation requires the default "_doc" type, which for external templates is added in the REST layer. Related #38637
1 parent cfbc24a commit 19b184d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

x-pack/plugin/core/src/main/resources/logstash-management.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
},
1010
"mappings" : {
11-
"doc" : {
11+
"_doc" : {
1212
"_meta": {
1313
"logstash-version": "${logstash.template.version}"
1414
},

x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
1111
import org.elasticsearch.common.inject.Module;
1212
import org.elasticsearch.common.settings.Settings;
13+
import org.elasticsearch.index.mapper.MapperService;
1314
import org.elasticsearch.plugins.ActionPlugin;
1415
import org.elasticsearch.plugins.Plugin;
1516
import org.elasticsearch.xpack.core.XPackPlugin;
@@ -63,6 +64,8 @@ public UnaryOperator<Map<String, IndexTemplateMetaData>> getIndexTemplateMetaDat
6364
templates.keySet().removeIf(OLD_LOGSTASH_INDEX_NAME::equals);
6465
TemplateUtils.loadTemplateIntoMap("/" + LOGSTASH_TEMPLATE_FILE_NAME + ".json", templates, LOGSTASH_INDEX_TEMPLATE_NAME,
6566
Version.CURRENT.toString(), TEMPLATE_VERSION_PATTERN, LogManager.getLogger(Logstash.class));
67+
//internal representation of typeless templates requires the default "_doc" type, which is also required for internal templates
68+
assert templates.get(LOGSTASH_INDEX_TEMPLATE_NAME).mappings().get(MapperService.SINGLE_MAPPING_NAME) != null;
6669
return templates;
6770
};
6871
}

0 commit comments

Comments
 (0)