Skip to content

Commit ce14fde

Browse files
kkrik-esalbertzaharovits
authored andcommitted
Add a unittest for synthetic source on disabled keyword (#110428)
* Add test for nested array, fix sort on nested test. * Fix sort on nested test. * Add a unittest for synthetic source on disabled keyword
1 parent 0958449 commit ce14fde

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

server/src/test/java/org/elasticsearch/index/mapper/KeywordFieldMapperTests.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,19 @@ public void testKeywordFieldUtf8LongerThan32766SourceOnly() throws Exception {
639639
mapper.parse(source(b -> b.field("field", stringBuilder.toString())));
640640
}
641641

642+
/**
643+
* Test that we track the synthetic source if field is neither indexed nor has doc values nor stored
644+
*/
645+
public void testSyntheticSourceForDisabledField() throws Exception {
646+
MapperService mapper = createMapperService(
647+
syntheticSourceFieldMapping(
648+
b -> b.field("type", "keyword").field("index", false).field("doc_values", false).field("store", false)
649+
)
650+
);
651+
String value = randomAlphaOfLengthBetween(1, 20);
652+
assertEquals("{\"field\":\"" + value + "\"}", syntheticSource(mapper.documentMapper(), b -> b.field("field", value)));
653+
}
654+
642655
@Override
643656
protected boolean supportsIgnoreMalformed() {
644657
return false;

0 commit comments

Comments
 (0)