@Test public void testNoLevelWithFieldTypeAsObject() throws Exception {
String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
DocumentMapper defaultMapper = MapperTests.newParser().parse(defaultMapping);
ParsedDocument doc = defaultMapper.parse("type", "1", XContentFactory.jsonBuilder()
.startObject()
.startObject("type").field("type_field", "type_value").endObject()
.field("test1", "value1")
.field("test2", "value2")
.startObject("inner").field("inner_field", "inner_value").endObject()
.endObject()
.copiedBytes());
// in this case, we analyze the type object as the actual document, and ignore the other same level fields
assertThat(doc.rootDoc().get("type_field"), equalTo("type_value"));
assertThat(doc.rootDoc().get("test1"), nullValue());
assertThat(doc.rootDoc().get("test2"), nullValue());
}