Skip to content

Commit d5bae2c

Browse files
authored
Control storing array source with index setting (#112397)
Introduce an index setting that forces storing the source of leaf field and object arrays in synthetic source mode. Nested objects are excluded as they already preserve ordering in synthetic source. Next step is to introduce override params at the mapper level that will allow disabling the source, or storing the source for arrays (if not enabled at index level), or storing the source for both arrays and singletons. This will happen in follow-up changes, so that we can benchmark the impact of this change in parallel. Related to #112012
1 parent d418853 commit d5bae2c

File tree

11 files changed

+938
-402
lines changed

11 files changed

+938
-402
lines changed

docs/changelog/112397.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 112397
2+
summary: Control storing array source with index setting
3+
area: Mapping
4+
type: enhancement
5+
issues: []

modules/data-streams/src/javaRestTest/java/org/elasticsearch/datastreams/logsdb/qa/StandardVersusLogsIndexModeRandomDataChallengeRestIT.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88

99
package org.elasticsearch.datastreams.logsdb.qa;
1010

11+
import org.elasticsearch.common.settings.Settings;
1112
import org.elasticsearch.common.time.DateFormatter;
1213
import org.elasticsearch.common.time.FormatNames;
1314
import org.elasticsearch.core.CheckedConsumer;
15+
import org.elasticsearch.index.mapper.Mapper;
1416
import org.elasticsearch.index.mapper.ObjectMapper;
1517
import org.elasticsearch.logsdb.datageneration.DataGenerator;
1618
import org.elasticsearch.logsdb.datageneration.DataGeneratorSpecification;
@@ -36,12 +38,14 @@
3638
*/
3739
public class StandardVersusLogsIndexModeRandomDataChallengeRestIT extends StandardVersusLogsIndexModeChallengeRestIT {
3840
private final ObjectMapper.Subobjects subobjects;
41+
private final boolean keepArraySource;
3942

4043
private final DataGenerator dataGenerator;
4144

4245
public StandardVersusLogsIndexModeRandomDataChallengeRestIT() {
4346
super();
4447
this.subobjects = randomFrom(ObjectMapper.Subobjects.values());
48+
this.keepArraySource = randomBoolean();
4549

4650
var specificationBuilder = DataGeneratorSpecification.builder().withFullyDynamicMapping(randomBoolean());
4751
if (subobjects != ObjectMapper.Subobjects.ENABLED) {
@@ -120,6 +124,13 @@ public void contenderMappings(XContentBuilder builder) throws IOException {
120124
}
121125
}
122126

127+
@Override
128+
public void contenderSettings(Settings.Builder builder) {
129+
if (keepArraySource) {
130+
builder.put(Mapper.SYNTHETIC_SOURCE_KEEP_INDEX_SETTING.getKey(), "arrays");
131+
}
132+
}
133+
123134
@Override
124135
protected XContentBuilder generateDocument(final Instant timestamp) throws IOException {
125136
var document = XContentFactory.jsonBuilder();

0 commit comments

Comments
 (0)