// partitions
execute("insert into dynamic_table (id, score, comment) values (2,10,'this is a new column')");
execute("insert into dynamic_table (id, score, new_comment) values (2,5,'this is a new column on a new partition')");
execute("refresh table dynamic_table");
ensureGreen();
GetIndexTemplatesResponse response = client().admin().indices()
.prepareGetTemplates(PartitionName.templateName("dynamic_table"))
.execute().actionGet();
assertThat(response.getIndexTemplates().size(), is(1));
IndexTemplateMetaData template = response.getIndexTemplates().get(0);
CompressedString mappingStr = template.mappings().get(Constants.DEFAULT_MAPPING_TYPE);
assertThat(mappingStr, is(notNullValue()));
Tuple<XContentType, Map<String, Object>> typeAndMap = XContentHelper.convertToMap(mappingStr.uncompressed(), false);
@SuppressWarnings("unchecked")
Map<String, Object> mapping = (Map<String, Object>)typeAndMap.v2().get(Constants.DEFAULT_MAPPING_TYPE);