Skip to content

Commit 8d4b1a2

Browse files
committed
Fixed synthetic source on indexed text fields
1 parent 24c41f2 commit 8d4b1a2

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
@@ -1450,10 +1450,9 @@ protected void parseCreateField(DocumentParserContext context) throws IOExceptio
14501450
if (phraseFieldInfo != null) {
14511451
context.doc().add(new Field(phraseFieldInfo.field, value, phraseFieldInfo.fieldType));
14521452
}
1453-
}
1453+
} else if (needsToSupportSyntheticSource() && fieldType.stored() == false) {
1454+
// if synthetic source needs to be supported, yet the field isn't stored, then we need to rely on something else
14541455

1455-
// if synthetic source needs to be supported, yet the field isn't stored, then we need to rely on something else
1456-
if (needsToSupportSyntheticSource() && fieldType.stored() == false) {
14571456
// if we can rely on the synthetic source delegate for synthetic source, then exit as there is nothing to do
14581457
if (fieldType().canUseSyntheticSourceDelegateForSyntheticSource(value)) {
14591458
return;
@@ -1639,6 +1638,10 @@ protected void write(XContentBuilder b, Object value) throws IOException {
16391638
});
16401639
}
16411640

1641+
if (isIndexed()) {
1642+
return super.syntheticSourceSupport();
1643+
}
1644+
16421645
return new SyntheticSourceSupport.Native(() -> syntheticFieldLoader(fullPath(), leafName()));
16431646
}
16441647

0 commit comments

Comments
 (0)