Skip to content

Commit

Permalink
Add a test for parsing doc with a flattened field (#74112)
Browse files Browse the repository at this point in the history
  • Loading branch information
javanna committed Jun 15, 2021
1 parent 92634cb commit 4ed2ec9
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1915,6 +1915,20 @@ public void testTypeless() throws IOException {
assertNull(doc.dynamicMappingsUpdate()); // no update since we reused the existing type
}

public void testParseWithFlattenedField() throws IOException {
DocumentMapper mapper = createDocumentMapper(fieldMapping(b -> b.field("type", "flattened")));
ParsedDocument doc = mapper.parse(source(b -> {
b.startObject("field");
b.field("first", "first");
b.field("second", "second");
b.endObject();
}));
assertNull(doc.dynamicMappingsUpdate());
assertNotNull(doc.rootDoc().getField("field"));
assertNull(doc.rootDoc().getField("field.first"));
assertNull(doc.rootDoc().getField("field.second"));
}

/**
* Mapper plugin providing a mock metadata field mapper implementation that supports setting its value
* as well as a mock runtime field parser.
Expand Down

0 comments on commit 4ed2ec9

Please sign in to comment.