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
This commit is contained in:
parent
aec2db78ea
commit
a8530c5531
|
@ -8,7 +8,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mappings" : {
|
"mappings" : {
|
||||||
"doc" : {
|
"_doc" : {
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"logstash-version": "${logstash.template.version}"
|
"logstash-version": "${logstash.template.version}"
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
|
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
|
||||||
import org.elasticsearch.common.inject.Module;
|
import org.elasticsearch.common.inject.Module;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.index.mapper.MapperService;
|
||||||
import org.elasticsearch.plugins.ActionPlugin;
|
import org.elasticsearch.plugins.ActionPlugin;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.xpack.core.XPackPlugin;
|
import org.elasticsearch.xpack.core.XPackPlugin;
|
||||||
|
@ -63,6 +64,8 @@ public class Logstash extends Plugin implements ActionPlugin {
|
||||||
templates.keySet().removeIf(OLD_LOGSTASH_INDEX_NAME::equals);
|
templates.keySet().removeIf(OLD_LOGSTASH_INDEX_NAME::equals);
|
||||||
TemplateUtils.loadTemplateIntoMap("/" + LOGSTASH_TEMPLATE_FILE_NAME + ".json", templates, LOGSTASH_INDEX_TEMPLATE_NAME,
|
TemplateUtils.loadTemplateIntoMap("/" + LOGSTASH_TEMPLATE_FILE_NAME + ".json", templates, LOGSTASH_INDEX_TEMPLATE_NAME,
|
||||||
Version.CURRENT.toString(), TEMPLATE_VERSION_PATTERN, LogManager.getLogger(Logstash.class));
|
Version.CURRENT.toString(), TEMPLATE_VERSION_PATTERN, LogManager.getLogger(Logstash.class));
|
||||||
|
//internal representation of typeless templates requires the default "_doc" type, which is also required for internal templates
|
||||||
|
assert templates.get(LOGSTASH_INDEX_TEMPLATE_NAME).mappings().get(MapperService.SINGLE_MAPPING_NAME) != null;
|
||||||
return templates;
|
return templates;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue