Skip to content

Commit

Permalink
reproduces the issue #105099
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyvfeng committed Feb 10, 2024
1 parent 6361d4d commit 8d5d0fd
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,21 @@ public void testMergeWithLimitRuntimeField() {
assertEquals(3, mergedAdd0.mapperSize());
assertEquals(4, mergedAdd1.mapperSize());
}
public void testMergedMappingSubobjectsFalse() {
ObjectMapper mergeInto = new ObjectMapper.Builder("parent", Explicit.IMPLICIT_FALSE)
.build(MapperBuilderContext.root(false, false));
RootObjectMapper mergeWith= new RootObjectMapper.Builder("parent", Explicit.IMPLICIT_TRUE).add(
new ObjectMapper.Builder("child", Explicit.IMPLICIT_TRUE).add(
new KeywordFieldMapper.Builder("grandchild", IndexVersion.current())
)
).build(MapperBuilderContext.root(false, false));
ObjectMapper merged = mergeInto.merge(mergeWith, MapperMergeContext.root(false, false, Long.MAX_VALUE));
ObjectMapper child = (ObjectMapper) merged.getMapper("child");
KeywordFieldMapper keywordFieldMapper = (KeywordFieldMapper) child.getMapper("grandchild");

assertNull(child);
assertNull(keywordFieldMapper);
}
private static RootObjectMapper createRootSubobjectFalseLeafWithDots() {
FieldMapper.Builder fieldBuilder = new KeywordFieldMapper.Builder("host.name", IndexVersion.current());
FieldMapper fieldMapper = fieldBuilder.build(MapperBuilderContext.root(false, false));
Expand Down Expand Up @@ -352,4 +366,5 @@ private TextFieldMapper.Builder createTextKeywordMultiField(String name, String
builder.multiFieldsBuilder.add(new KeywordFieldMapper.Builder(multiFieldName, IndexVersion.current()));
return builder;
}

}

0 comments on commit 8d5d0fd

Please sign in to comment.