Skip to content

Commit

Permalink
Adding back doc to template mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Feb 2, 2019
1 parent ab9c7ae commit 8876abe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ public void testLoadTemplate() throws IOException {
assertTemplate(source, equalTo("{\n" +
" \"index_patterns\": \".monitoring-data-" + TEMPLATE_VERSION + "\",\n" +
" \"mappings\": {\n" +
" \"_meta\": {\n" +
" \"template.version\": \"" + TEMPLATE_VERSION + "\"\n" +
" \"doc\": {\n" +
" \"_meta\": {\n" +
" \"template.version\": \"" + TEMPLATE_VERSION + "\"\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ private static BytesReference generateTemplateSource(final String name, final In
.field("index.number_of_replicas", 0)
.endObject()
.startObject("mappings")
.field("enabled", false)
.startObject("_meta")
.field("test", true)
.startObject("doc")
.startObject("_meta")
.field("test", true)
.endObject()
.field("enabled", false)
.endObject()
.endObject();

Expand Down Expand Up @@ -191,7 +193,7 @@ private void assertTemplateNotUpdated() {
final String name = MonitoringTemplateUtils.templateName(system.getSystem());

for (IndexTemplateMetaData template : client().admin().indices().prepareGetTemplates(name).get().getIndexTemplates()) {
final String docMapping = template.getMappings().toString();
final String docMapping = template.getMappings().get("doc").toString();

assertThat(docMapping, notNullValue());
assertThat(docMapping, containsString("test"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"index_patterns": ".monitoring-data-${monitoring.template.version}",
"mappings": {
"_meta": {
"template.version": "${monitoring.template.version}"
"doc": {
"_meta": {
"template.version": "${monitoring.template.version}"
}
}
}
}

0 comments on commit 8876abe

Please sign in to comment.