From 8876abecf7aaf94b80198565312b4a15582e30d4 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 1 Feb 2019 16:07:51 -0800 Subject: [PATCH] Adding back doc to template mappings --- .../exporter/MonitoringTemplateUtilsTests.java | 6 ++++-- .../local/LocalExporterResourceIntegTests.java | 10 ++++++---- .../monitoring/src/test/resources/monitoring-test.json | 6 ++++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/MonitoringTemplateUtilsTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/MonitoringTemplateUtilsTests.java index 2237b4f1ce55d..5c010439243a0 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/MonitoringTemplateUtilsTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/MonitoringTemplateUtilsTests.java @@ -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")); diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterResourceIntegTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterResourceIntegTests.java index 117c345e14f65..5448521594dfe 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterResourceIntegTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterResourceIntegTests.java @@ -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(); @@ -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")); diff --git a/x-pack/plugin/monitoring/src/test/resources/monitoring-test.json b/x-pack/plugin/monitoring/src/test/resources/monitoring-test.json index bd85ab88cc1c9..e2abf9e699afe 100644 --- a/x-pack/plugin/monitoring/src/test/resources/monitoring-test.json +++ b/x-pack/plugin/monitoring/src/test/resources/monitoring-test.json @@ -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}" + } } } }