Skip to content

Commit b8b7139

Browse files
committed
Fixed synthetic source on indexed text fields
1 parent c28989c commit b8b7139

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,10 +1425,9 @@ protected void parseCreateField(DocumentParserContext context) throws IOExceptio
14251425
if (phraseFieldInfo != null) {
14261426
context.doc().add(new Field(phraseFieldInfo.field, value, phraseFieldInfo.fieldType));
14271427
}
1428-
}
1428+
} else if (needsToSupportSyntheticSource() && fieldType.stored() == false) {
1429+
// if synthetic source needs to be supported, yet the field isn't stored, then we need to rely on something else
14291430

1430-
// if synthetic source needs to be supported, yet the field isn't stored, then we need to rely on something else
1431-
if (needsToSupportSyntheticSource() && fieldType.stored() == false) {
14321431
// if we can rely on the synthetic source delegate for synthetic source, then exit as there is nothing to do
14331432
if (fieldType().canUseSyntheticSourceDelegateForSyntheticSource(value)) {
14341433
return;
@@ -1614,6 +1613,10 @@ protected void write(XContentBuilder b, Object value) throws IOException {
16141613
});
16151614
}
16161615

1616+
if (isIndexed()) {
1617+
return super.syntheticSourceSupport();
1618+
}
1619+
16171620
return new SyntheticSourceSupport.Native(() -> syntheticFieldLoader(fullPath(), leafName()));
16181621
}
16191622

0 commit comments

Comments
 (0)