Skip to content

Commit cec5894

Browse files
committed
Dont store text fields in binary format
1 parent 3b00ab3 commit cec5894

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ protected String delegatingTo() {
10621062
// But if a text field is a multi field it won't have an entry in _ignored_source.
10631063
// The parent might, but we don't have enough context here to figure this out.
10641064
// So we bail.
1065-
if (isSyntheticSource && syntheticSourceDelegate == null && parentField == null) {
1065+
if (isSyntheticSource && syntheticSourceDelegate.isEmpty() && parentField == null) {
10661066
return fallbackSyntheticSourceBlockLoader(blContext);
10671067
}
10681068

@@ -1115,7 +1115,7 @@ public Builder builder(BlockFactory factory, int expectedCount) {
11151115
* using whatever
11161116
*/
11171117
private BlockSourceReader.LeafIteratorLookup blockReaderDisiLookup(BlockLoaderContext blContext) {
1118-
if (isSyntheticSource && syntheticSourceDelegate != null) {
1118+
if (isSyntheticSource && syntheticSourceDelegate.isPresent()) {
11191119
// Since we are using synthetic source and a delegate, we can't use this field
11201120
// to determine if the delegate has values in the document (f.e. handling of `null` is different
11211121
// between text and keyword).
@@ -1426,11 +1426,8 @@ protected void parseCreateField(DocumentParserContext context) throws IOExceptio
14261426
return;
14271427
}
14281428

1429-
// otherwise, we need to store a copy of this value so that synthetic source can load it
1430-
var utfBytes = value.bytes();
1431-
var bytesRef = new BytesRef(utfBytes.bytes(), utfBytes.offset(), utfBytes.length());
14321429
final String fieldName = fieldType().syntheticSourceFallbackFieldName(true);
1433-
context.doc().add(new StoredField(fieldName, bytesRef));
1430+
context.doc().add(new StoredField(fieldName, value.string()));
14341431
}
14351432
}
14361433

0 commit comments

Comments
 (0)