Skip to content

Commit 2913413

Browse files
authored
Merge branch 'main' into connect-references
2 parents 98ac61d + 086329c commit 2913413

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ public static class MatchOnlyTextFieldType extends StringFieldType {
157157

158158
private final Analyzer indexAnalyzer;
159159
private final TextFieldType textFieldType;
160+
private final String originalName;
160161

161162
public MatchOnlyTextFieldType(
162163
String name,
@@ -168,6 +169,7 @@ public MatchOnlyTextFieldType(
168169
super(name, true, false, false, tsi, meta);
169170
this.indexAnalyzer = Objects.requireNonNull(indexAnalyzer);
170171
this.textFieldType = new TextFieldType(name, isSyntheticSource);
172+
this.originalName = isSyntheticSource ? name() + "._original" : null;
171173
}
172174

173175
public MatchOnlyTextFieldType(String name) {
@@ -394,7 +396,7 @@ protected BytesRef storedToBytesRef(Object stored) {
394396
}
395397

396398
private String storedFieldNameForSyntheticSource() {
397-
return name() + "._original";
399+
return originalName;
398400
}
399401
}
400402

muted-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ tests:
332332
- class: org.elasticsearch.entitlement.runtime.policy.PolicyManagerTests
333333
method: testFilesEntitlementsWithExclusive
334334
issue: https://github.com/elastic/elasticsearch/issues/123657
335+
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
336+
method: test {p0=search.vectors/41_knn_search_bbq_hnsw/Test knn search}
337+
issue: https://github.com/elastic/elasticsearch/issues/123727
335338

336339
# Examples:
337340
#

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ void addToLuceneDocument(DocumentParserContext context) throws IOException {
6363
offsetToOrd[nullOffset] = -1;
6464
}
6565

66-
try (var streamOutput = new BytesStreamOutput()) {
66+
int expectedSize = offsetToOrd.length + 1; // Initialize buffer to avoid unnecessary resizing, assume 1 byte per offset + size.
67+
try (var streamOutput = new BytesStreamOutput(expectedSize)) {
6768
// Could just use vint for array length, but this allows for decoding my_field: null as -1
6869
streamOutput.writeVInt(BitUtil.zigZagEncode(offsetToOrd.length));
6970
for (int ord : offsetToOrd) {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,7 @@ public boolean hasDocValuesSkipper() {
10581058
private final boolean useDocValuesSkipper;
10591059
private final String offsetsFieldName;
10601060
private final SourceKeepMode indexSourceKeepMode;
1061+
private final String originalName;
10611062

10621063
private KeywordFieldMapper(
10631064
String simpleName,
@@ -1089,6 +1090,7 @@ private KeywordFieldMapper(
10891090
this.useDocValuesSkipper = useDocValuesSkipper;
10901091
this.offsetsFieldName = offsetsFieldName;
10911092
this.indexSourceKeepMode = indexSourceKeepMode;
1093+
this.originalName = isSyntheticSource ? fullPath() + "._original" : null;
10921094
}
10931095

10941096
@Override
@@ -1255,7 +1257,7 @@ boolean hasNormalizer() {
12551257
* for synthetic source.
12561258
*/
12571259
private String originalName() {
1258-
return fullPath() + "._original";
1260+
return originalName;
12591261
}
12601262

12611263
@Override

x-pack/plugin/wildcard/src/main/java/org/elasticsearch/xpack/wildcard/mapper/WildcardFieldMapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ protected String parseSourceValue(Object value) {
896896
private final int ignoreAbove;
897897
private final int ignoreAboveDefault;
898898
private final boolean storeIgnored;
899+
private final String originalName;
899900

900901
private WildcardFieldMapper(
901902
String simpleName,
@@ -911,6 +912,7 @@ private WildcardFieldMapper(
911912
this.indexVersionCreated = indexVersionCreated;
912913
this.ignoreAbove = builder.ignoreAbove.getValue();
913914
this.ignoreAboveDefault = builder.ignoreAboveDefault;
915+
this.originalName = storeIgnored ? fullPath() + "._original" : null;
914916
}
915917

916918
@Override
@@ -956,7 +958,7 @@ protected void parseCreateField(DocumentParserContext context) throws IOExceptio
956958
}
957959

958960
private String originalName() {
959-
return fullPath() + "._original";
961+
return originalName;
960962
}
961963

962964
void createFields(String value, LuceneDocument parseDoc, List<IndexableField> fields) {

0 commit comments

Comments
 (0)