@@ -1084,7 +1084,7 @@ protected String delegatingTo() {
10841084 // But if a text field is a multi field it won't have an entry in _ignored_source.
10851085 // The parent might, but we don't have enough context here to figure this out.
10861086 // So we bail.
1087- if (isSyntheticSource && syntheticSourceDelegate == null && parentField == null ) {
1087+ if (isSyntheticSource && syntheticSourceDelegate . isEmpty () && parentField == null ) {
10881088 return fallbackSyntheticSourceBlockLoader (blContext );
10891089 }
10901090
@@ -1137,7 +1137,7 @@ public Builder builder(BlockFactory factory, int expectedCount) {
11371137 * using whatever
11381138 */
11391139 private BlockSourceReader .LeafIteratorLookup blockReaderDisiLookup (BlockLoaderContext blContext ) {
1140- if (isSyntheticSource && syntheticSourceDelegate != null ) {
1140+ if (isSyntheticSource && syntheticSourceDelegate . isPresent () ) {
11411141 // Since we are using synthetic source and a delegate, we can't use this field
11421142 // to determine if the delegate has values in the document (f.e. handling of `null` is different
11431143 // between text and keyword).
@@ -1451,11 +1451,8 @@ protected void parseCreateField(DocumentParserContext context) throws IOExceptio
14511451 return ;
14521452 }
14531453
1454- // otherwise, we need to store a copy of this value so that synthetic source can load it
1455- var utfBytes = value .bytes ();
1456- var bytesRef = new BytesRef (utfBytes .bytes (), utfBytes .offset (), utfBytes .length ());
14571454 final String fieldName = fieldType ().syntheticSourceFallbackFieldName (true );
1458- context .doc ().add (new StoredField (fieldName , bytesRef ));
1455+ context .doc ().add (new StoredField (fieldName , value . string () ));
14591456 }
14601457 }
14611458
0 commit comments