execute("insert into dynamic_table (id, score, new_col) values (?, ?, ?)",
new Object[]{6, 3, "hello"});
execute("refresh table dynamic_table");
ensureGreen();
MappingMetaData partitionMetaData = clusterService().state().metaData().indices()
.get(new PartitionName("dynamic_table", Arrays.asList(new BytesRef("10.0"))).stringValue())
.getMappings().get(Constants.DEFAULT_MAPPING_TYPE);
assertThat(String.valueOf(partitionMetaData.getSourceAsMap().get("dynamic")), is(String.valueOf(ColumnPolicy.DYNAMIC.mappingValue())));
partitionMetaData = clusterService().state().metaData().indices()
.get(new PartitionName("dynamic_table", Arrays.asList(new BytesRef("5.0"))).stringValue())
.getMappings().get(Constants.DEFAULT_MAPPING_TYPE);
assertThat(String.valueOf(partitionMetaData.getSourceAsMap().get("dynamic")), is(String.valueOf(ColumnPolicy.DYNAMIC.mappingValue())));
partitionMetaData = clusterService().state().metaData().indices()
.get(new PartitionName("dynamic_table", Arrays.asList(new BytesRef("3.0"))).stringValue())
.getMappings().get(Constants.DEFAULT_MAPPING_TYPE);
assertThat(String.valueOf(partitionMetaData.getSourceAsMap().get("dynamic")), is(String.valueOf(ColumnPolicy.DYNAMIC.mappingValue())));
}