Skip to content

Commit 322e5fe

Browse files
Remove feature flag for coalesced ignored source (#135039)
Follow-up to #133839 to remove the feature flag and enable the feature in production.
1 parent 69c0082 commit 322e5fe

File tree

5 files changed

+19
-36
lines changed

5 files changed

+19
-36
lines changed

docs/changelog/135039.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 135039
2+
summary: Use optimized field visitor for ignored source queries
3+
area: Mapping
4+
type: enhancement
5+
issues: []

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,12 @@ private static Version parseUnchecked(String version) {
180180
public static final IndexVersion SPARSE_VECTOR_PRUNING_INDEX_OPTIONS_SUPPORT = def(9_031_0_00, Version.LUCENE_10_2_2);
181181
public static final IndexVersion DEFAULT_DENSE_VECTOR_TO_BBQ_HNSW = def(9_032_0_00, Version.LUCENE_10_2_2);
182182
public static final IndexVersion MATCH_ONLY_TEXT_STORED_AS_BYTES = def(9_033_0_00, Version.LUCENE_10_2_2);
183-
public static final IndexVersion IGNORED_SOURCE_FIELDS_PER_ENTRY_WITH_FF = def(9_034_0_00, Version.LUCENE_10_2_2);
183+
public static final IndexVersion IGNORED_SOURCE_COALESCED_ENTRIES_WITH_FF = def(9_034_0_00, Version.LUCENE_10_2_2);
184184
public static final IndexVersion EXCLUDE_SOURCE_VECTORS_DEFAULT = def(9_035_0_00, Version.LUCENE_10_2_2);
185185
public static final IndexVersion DISABLE_NORMS_BY_DEFAULT_FOR_LOGSDB_AND_TSDB = def(9_036_0_00, Version.LUCENE_10_2_2);
186186
public static final IndexVersion TSID_CREATED_DURING_ROUTING = def(9_037_0_00, Version.LUCENE_10_2_2);
187187
public static final IndexVersion UPGRADE_TO_LUCENE_10_3_0 = def(9_038_0_00, Version.LUCENE_10_3_0);
188+
public static final IndexVersion IGNORED_SOURCE_COALESCED_ENTRIES = def(9_039_0_00, Version.LUCENE_10_3_0);
188189

189190
/*
190191
* STOP! READ THIS FIRST! No, really,

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,13 @@ public IgnoredSourceFormat ignoredSourceFormat() {
487487
}
488488

489489
public static IgnoredSourceFormat ignoredSourceFormat(IndexVersion indexCreatedVersion) {
490-
return indexCreatedVersion.onOrAfter(IndexVersions.IGNORED_SOURCE_FIELDS_PER_ENTRY_WITH_FF)
491-
&& COALESCE_IGNORED_SOURCE_ENTRIES.isEnabled()
492-
? IgnoredSourceFormat.COALESCED_SINGLE_IGNORED_SOURCE
493-
: IgnoredSourceFormat.LEGACY_SINGLE_IGNORED_SOURCE;
490+
IndexVersion switchToNewFormatVersion = COALESCE_IGNORED_SOURCE_ENTRIES.isEnabled()
491+
? IndexVersions.IGNORED_SOURCE_COALESCED_ENTRIES_WITH_FF
492+
: IndexVersions.IGNORED_SOURCE_COALESCED_ENTRIES;
493+
494+
return indexCreatedVersion.onOrAfter(switchToNewFormatVersion)
495+
? IgnoredSourceFormat.COALESCED_SINGLE_IGNORED_SOURCE
496+
: IgnoredSourceFormat.LEGACY_SINGLE_IGNORED_SOURCE;
494497
}
495498

496499
@Override

server/src/test/java/org/elasticsearch/index/mapper/IgnoredSourceFieldMapperTests.java

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,7 @@ public void testEncodeFieldToMap() throws IOException {
343343
ParsedDocument parsedDocument = getParsedDocumentWithFieldLimit(b -> b.field("my_value", value));
344344
IgnoredSourceFieldMapper.MappedNameValue mappedNameValue;
345345
var bytes = parsedDocument.rootDoc().getField(IgnoredSourceFieldMapper.NAME).binaryValue();
346-
if (IgnoredSourceFieldMapper.COALESCE_IGNORED_SOURCE_ENTRIES.isEnabled()) {
347-
mappedNameValue = IgnoredSourceFieldMapper.CoalescedIgnoredSourceEncoding.decodeAsMap(bytes).getFirst();
348-
} else {
349-
mappedNameValue = IgnoredSourceFieldMapper.LegacyIgnoredSourceEncoding.decodeAsMap(bytes);
350-
}
346+
mappedNameValue = IgnoredSourceFieldMapper.CoalescedIgnoredSourceEncoding.decodeAsMap(bytes).getFirst();
351347
assertEquals("my_value", mappedNameValue.nameValue().name());
352348
assertEquals(value, mappedNameValue.map().get("my_value"));
353349
}
@@ -360,18 +356,10 @@ public void testEncodeObjectToMapAndDecode() throws IOException {
360356
);
361357
var bytes = parsedDocument.rootDoc().getField(IgnoredSourceFieldMapper.NAME).binaryValue();
362358
IgnoredSourceFieldMapper.MappedNameValue mappedNameValue;
363-
if (IgnoredSourceFieldMapper.COALESCE_IGNORED_SOURCE_ENTRIES.isEnabled()) {
364-
mappedNameValue = IgnoredSourceFieldMapper.CoalescedIgnoredSourceEncoding.decodeAsMap(bytes).getFirst();
365-
} else {
366-
mappedNameValue = IgnoredSourceFieldMapper.LegacyIgnoredSourceEncoding.decodeAsMap(bytes);
367-
}
359+
mappedNameValue = IgnoredSourceFieldMapper.CoalescedIgnoredSourceEncoding.decodeAsMap(bytes).getFirst();
368360
assertEquals("my_object", mappedNameValue.nameValue().name());
369361
assertEquals(value, ((Map<String, ?>) mappedNameValue.map().get("my_object")).get("my_value"));
370-
if (IgnoredSourceFieldMapper.COALESCE_IGNORED_SOURCE_ENTRIES.isEnabled()) {
371-
assertEquals(bytes, IgnoredSourceFieldMapper.CoalescedIgnoredSourceEncoding.encodeFromMap(List.of(mappedNameValue)));
372-
} else {
373-
assertEquals(bytes, IgnoredSourceFieldMapper.LegacyIgnoredSourceEncoding.encodeFromMap(mappedNameValue));
374-
}
362+
assertEquals(bytes, IgnoredSourceFieldMapper.CoalescedIgnoredSourceEncoding.encodeFromMap(List.of(mappedNameValue)));
375363
}
376364

377365
public void testEncodeArrayToMapAndDecode() throws IOException {
@@ -383,18 +371,10 @@ public void testEncodeArrayToMapAndDecode() throws IOException {
383371
});
384372
var bytes = parsedDocument.rootDoc().getField(IgnoredSourceFieldMapper.NAME).binaryValue();
385373
IgnoredSourceFieldMapper.MappedNameValue mappedNameValue;
386-
if (IgnoredSourceFieldMapper.COALESCE_IGNORED_SOURCE_ENTRIES.isEnabled()) {
387-
mappedNameValue = IgnoredSourceFieldMapper.CoalescedIgnoredSourceEncoding.decodeAsMap(bytes).getFirst();
388-
} else {
389-
mappedNameValue = IgnoredSourceFieldMapper.LegacyIgnoredSourceEncoding.decodeAsMap(bytes);
390-
}
374+
mappedNameValue = IgnoredSourceFieldMapper.CoalescedIgnoredSourceEncoding.decodeAsMap(bytes).getFirst();
391375
assertEquals("my_array", mappedNameValue.nameValue().name());
392376
assertThat((List<?>) mappedNameValue.map().get("my_array"), Matchers.contains(Map.of("int_value", 10), Map.of("int_value", 20)));
393-
if (IgnoredSourceFieldMapper.COALESCE_IGNORED_SOURCE_ENTRIES.isEnabled()) {
394-
assertEquals(bytes, IgnoredSourceFieldMapper.CoalescedIgnoredSourceEncoding.encodeFromMap(List.of(mappedNameValue)));
395-
} else {
396-
assertEquals(bytes, IgnoredSourceFieldMapper.LegacyIgnoredSourceEncoding.encodeFromMap(mappedNameValue));
397-
}
377+
assertEquals(bytes, IgnoredSourceFieldMapper.CoalescedIgnoredSourceEncoding.encodeFromMap(List.of(mappedNameValue)));
398378
}
399379

400380
public void testMultipleIgnoredFieldsRootObject() throws IOException {

x-pack/plugin/logsdb/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,4 @@ tasks.named("javaRestTest").configure {
4343

4444
tasks.named('yamlRestTest') {
4545
usesDefaultDistribution("Requires a bunch of xpack plugins")
46-
47-
if (buildParams.snapshotBuild == false) {
48-
systemProperty 'tests.rest.blacklist', [
49-
'20_ignored_source/*'
50-
].join(',')
51-
}
5246
}

0 commit comments

Comments
 (0)