UpdateMappingTests - updateDefaultMappingSettings now creates the index with a mapping.
This commit is contained in:
parent
e5f459af83
commit
9d28002077
|
@ -177,19 +177,13 @@ public class UpdateMappingTests extends AbstractSharedClusterTest {
|
|||
@Test
|
||||
public void updateDefaultMappingSettings() throws Exception {
|
||||
|
||||
// TODO: bleskes: move back to combined index and mapping creation (pending bug fix concerning concurrent not-acked mapping requests)
|
||||
createIndex("test");
|
||||
|
||||
logger.info("Creating _default_ mappings");
|
||||
PutMappingResponse putResponse = client().admin().indices().preparePutMapping("test").setType(MapperService.DEFAULT_MAPPING).setSource(
|
||||
logger.info("Creating index with _default_ mappings");
|
||||
client().admin().indices().prepareCreate("test").addMapping(MapperService.DEFAULT_MAPPING,
|
||||
JsonXContent.contentBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
|
||||
.field("date_detection", false)
|
||||
.endObject().endObject()
|
||||
).get();
|
||||
|
||||
assertThat(putResponse.isAcknowledged(), equalTo(true));
|
||||
logger.info("DONE: Creating _default_ mappings");
|
||||
|
||||
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();
|
||||
assertThat(defaultMapping, hasKey("date_detection"));
|
||||
|
@ -197,7 +191,7 @@ public class UpdateMappingTests extends AbstractSharedClusterTest {
|
|||
|
||||
logger.info("Emptying _default_ mappings");
|
||||
// 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)
|
||||
.endObject().endObject()
|
||||
).get();
|
||||
|
|
Loading…
Reference in New Issue