@Test
public void define_fields() {
NewIndex index = new NewIndex("issues", defaultSettingsConfiguration);
NewIndex.NewIndexType mapping = index.createType("issue");
mapping.setAttribute("dynamic", "true");
mapping.setProperty("foo_field", ImmutableMap.of("type", "keyword"));
mapping.createBooleanField("boolean_field");
mapping.createByteField("byte_field");
mapping.createDateTimeField("dt_field");
mapping.createDoubleField("double_field");
mapping.createIntegerField("int_field");
mapping.createLongField("long_field");
mapping.createShortField("short_field");
mapping.createUuidPathField("uuid_path_field");
mapping = index.getTypes().get("issue");
assertThat(mapping).isNotNull();
assertThat(mapping.getAttributes().get("dynamic")).isEqualTo("true");
assertThat(mapping.getProperty("foo_field")).isInstanceOf(Map.class);
assertThat((Map) mapping.getProperty("foo_field")).containsEntry("type", "keyword");
assertThat((Map) mapping.getProperty("byte_field")).isNotEmpty();
assertThat((Map) mapping.getProperty("double_field")).isNotEmpty();
assertThat((Map) mapping.getProperty("dt_field")).isNotEmpty();
assertThat((Map) mapping.getProperty("int_field")).containsEntry("type", "integer");
assertThat((Map) mapping.getProperty("long_field")).isNotEmpty();
assertThat((Map) mapping.getProperty("short_field")).isNotEmpty();
assertThat((Map) mapping.getProperty("uuid_path_field")).isNotEmpty();
assertThat((Map) mapping.getProperty("unknown")).isNull();
}