UpdateMappingTests - updateDefaultMappingSettings now creates the index with a mapping.

This commit is contained in:
Boaz Leskes 2013-08-13 17:16:11 +02:00
parent e5f459af83
commit 9d28002077
1 changed files with 3 additions and 9 deletions

View File

@ -177,19 +177,13 @@ public class UpdateMappingTests extends AbstractSharedClusterTest {
@Test @Test
public void updateDefaultMappingSettings() throws Exception { public void updateDefaultMappingSettings() throws Exception {
// TODO: bleskes: move back to combined index and mapping creation (pending bug fix concerning concurrent not-acked mapping requests) logger.info("Creating index with _default_ mappings");
createIndex("test"); client().admin().indices().prepareCreate("test").addMapping(MapperService.DEFAULT_MAPPING,
logger.info("Creating _default_ mappings");
PutMappingResponse putResponse = client().admin().indices().preparePutMapping("test").setType(MapperService.DEFAULT_MAPPING).setSource(
JsonXContent.contentBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING) JsonXContent.contentBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
.field("date_detection", false) .field("date_detection", false)
.endObject().endObject() .endObject().endObject()
).get(); ).get();
assertThat(putResponse.isAcknowledged(), equalTo(true));
logger.info("DONE: Creating _default_ mappings");
GetMappingsResponse getResponse = client().admin().indices().prepareGetMappings("test").addTypes(MapperService.DEFAULT_MAPPING).get(); GetMappingsResponse getResponse = client().admin().indices().prepareGetMappings("test").addTypes(MapperService.DEFAULT_MAPPING).get();
Map<String, Object> defaultMapping = getResponse.getMappings().get("test").get(MapperService.DEFAULT_MAPPING).sourceAsMap(); Map<String, Object> defaultMapping = getResponse.getMappings().get("test").get(MapperService.DEFAULT_MAPPING).sourceAsMap();
assertThat(defaultMapping, hasKey("date_detection")); assertThat(defaultMapping, hasKey("date_detection"));
@ -197,7 +191,7 @@ public class UpdateMappingTests extends AbstractSharedClusterTest {
logger.info("Emptying _default_ mappings"); logger.info("Emptying _default_ mappings");
// now remove it // now remove it
putResponse = client().admin().indices().preparePutMapping("test").setType(MapperService.DEFAULT_MAPPING).setSource( PutMappingResponse putResponse = client().admin().indices().preparePutMapping("test").setType(MapperService.DEFAULT_MAPPING).setSource(
JsonXContent.contentBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING) JsonXContent.contentBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
.endObject().endObject() .endObject().endObject()
).get(); ).get();