Skip to content

Commit e037047

Browse files
committed
experiment: store ignored source as binary doc values.
1 parent 7383e94 commit e037047

File tree

6 files changed

+393
-96
lines changed

6 files changed

+393
-96
lines changed

server/src/main/java/org/elasticsearch/index/IndexVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ private static Version parseUnchecked(String version) {
224224
public static final IndexVersion TIME_SERIES_USE_SYNTHETIC_ID_94 = def(9_071_0_00, Version.LUCENE_10_3_2);
225225
public static final IndexVersion TIME_SERIES_DOC_VALUES_FORMAT_VERSION_3 = def(9_072_0_00, Version.LUCENE_10_3_2);
226226
public static final IndexVersion STORE_IGNORED_MALFORMED_IN_BINARY_DOC_VALUES = def(9_073_0_00, Version.LUCENE_10_3_2);
227+
public static final IndexVersion IGNORED_SOURCE_AS_DOC_VALUES = def(9_074_0_00, Version.LUCENE_10_3_2);
227228

228229
/*
229230
* STOP! READ THIS FIRST! No, really,

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,27 @@ protected FallbackSyntheticSourceBlockLoader(
5757
this.fieldPaths = splitIntoFieldPaths(fieldName);
5858
}
5959

60+
/**
61+
* Returns the ignored source format used by this loader.
62+
*/
63+
public IgnoredSourceFieldMapper.IgnoredSourceFormat ignoredSourceFormat() {
64+
return ignoredSourceFormat;
65+
}
66+
6067
@Override
6168
public IOFunction<CircuitBreaker, ColumnAtATimeReader> columnAtATimeReader(LeafReaderContext context) {
6269
return null;
6370
}
6471

6572
@Override
6673
public RowStrideReader rowStrideReader(CircuitBreaker breaker, LeafReaderContext context) throws IOException {
67-
return new IgnoredSourceRowStrideReader<>(breaker, fieldName, fieldPaths, reader, ignoredSourceFormat);
74+
return new IgnoredSourceRowStrideReader<>(
75+
breaker,
76+
fieldName,
77+
fieldPaths,
78+
reader,
79+
ignoredSourceFormat.createLeafLoader(context.reader())
80+
);
6881
}
6982

7083
@Override
@@ -107,28 +120,29 @@ private static class IgnoredSourceRowStrideReader<T> implements RowStrideReader
107120
// Contains name of the field and all its parents
108121
private final Set<String> fieldPaths;
109122
private final Reader<T> reader;
110-
private final IgnoredSourceFieldMapper.IgnoredSourceFormat ignoredSourceFormat;
123+
private final IgnoredSourceFieldMapper.IgnoredSourceLeafLoader ignoredSourceLeafLoader;
111124

112125
IgnoredSourceRowStrideReader(
113126
CircuitBreaker breaker,
114127
String fieldName,
115128
Set<String> fieldPaths,
116129
Reader<T> reader,
117-
IgnoredSourceFieldMapper.IgnoredSourceFormat ignoredSourceFormat
130+
IgnoredSourceFieldMapper.IgnoredSourceLeafLoader ignoredSourceLeafLoader
118131
) {
119132
breaker.addEstimateBytesAndMaybeBreak(ESTIMATED_SIZE, "load blocks");
120133
this.breaker = breaker;
121134
this.fieldName = fieldName;
122135
this.fieldPaths = fieldPaths;
123136
this.reader = reader;
124-
this.ignoredSourceFormat = ignoredSourceFormat;
137+
this.ignoredSourceLeafLoader = ignoredSourceLeafLoader;
125138
}
126139

127140
@Override
128141
public void read(int docId, StoredFields storedFields, Builder builder) throws IOException {
129-
Map<String, List<IgnoredSourceFieldMapper.NameValue>> valuesForFieldAndParents = ignoredSourceFormat.loadSingleIgnoredField(
142+
Map<String, List<IgnoredSourceFieldMapper.NameValue>> valuesForFieldAndParents = ignoredSourceLeafLoader.loadSingleIgnoredField(
130143
fieldPaths,
131-
storedFields.storedFields()
144+
storedFields.storedFields(),
145+
docId
132146
);
133147

134148
if (valuesForFieldAndParents.isEmpty()) {

0 commit comments

Comments
 (0)