Skip to content

Commit ae49fd8

Browse files
committed
Dont store text fields in binary format
1 parent a70dc9a commit ae49fd8

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();
10671067
}
10681068

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

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

0 commit comments

Comments
 (0)