-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to skip using _ignored_source field for synthetic source #112963
Conversation
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
Diff is mostly tests. |
|
||
String syntheticSource = syntheticSource(mapperService, inputDocument); | ||
// Values are not loaded. | ||
assertEquals("{}", syntheticSource); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flip to false, verify that the field gets read.
|
||
String syntheticSource = syntheticSource(mapperService, inputDocument); | ||
// Values are not loaded. | ||
assertEquals("{}", syntheticSource); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
assertThat(roundTripSyntheticSource, equalTo(syntheticSource)); | ||
validateRoundTripReader(syntheticSource, reader, roundTripReader); | ||
} | ||
} | ||
} | ||
|
||
protected static String syntheticSource(DocumentMapper mapper, IndexReader reader, int docId) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep this flavor and pass empty indexSettings
for the cases we don't care. That should reduce the churn for testing files..
|
||
static final NodeFeature TRACK_IGNORED_SOURCE = new NodeFeature("mapper.track_ignored_source"); | ||
|
||
public static final Setting<Boolean> SKIP_IGNORED_SOURCE_WRITE_SETTING = Setting.boolSetting( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add java doc on top of these public settings to explain what they do exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the java doc is now empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, fixed.
this.syntheticFieldLoaderLeafSupplier = fieldLoaderSupplier; | ||
this.requiredStoredFields = syntheticFieldLoaderLeafSupplier.get() | ||
.storedFieldLoaders() | ||
.map(Map.Entry::getKey) | ||
.collect(Collectors.toSet()); | ||
this.requiredStoredFields.add(IgnoredSourceFieldMapper.NAME); | ||
if (indexSettings.getSkipIgnoredSourceRead() == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding was that we only need to ignore _ignore_source
at read time, like is done here. This to avoid the potential errors when synthesizing the source. An escape hatch. Do we need ignore _ignore_source
at write time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to add both, in case we have a bug at some point (...) with indexing. These settings won't be advertised, but we can give them to support in case we have a really urgent SDH (ingestion blocked etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see. An another escape hatch if for some reason we have a bug at index time.
@elasticmachine update branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - this approach is cleaner
|
||
static final NodeFeature TRACK_IGNORED_SOURCE = new NodeFeature("mapper.track_ignored_source"); | ||
|
||
public static final Setting<Boolean> SKIP_IGNORED_SOURCE_WRITE_SETTING = Setting.boolSetting( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the java doc is now empty
💔 Backport failed
You can use sqren/backport to manually backport by running |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
…lastic#112963) (cherry picked from commit 36b3549) # Conflicts: # server/src/main/java/org/elasticsearch/common/settings/IndexScopedSettings.java # server/src/main/java/org/elasticsearch/index/IndexSettings.java # server/src/main/java/org/elasticsearch/index/mapper/DocumentParserContext.java # server/src/main/java/org/elasticsearch/index/mapper/NestedObjectMapper.java # x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/SemanticTextFieldMapper.java
…112963) (#113065) (cherry picked from commit 36b3549) # Conflicts: # server/src/main/java/org/elasticsearch/common/settings/IndexScopedSettings.java # server/src/main/java/org/elasticsearch/index/IndexSettings.java # server/src/main/java/org/elasticsearch/index/mapper/DocumentParserContext.java # server/src/main/java/org/elasticsearch/index/mapper/NestedObjectMapper.java # x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/SemanticTextFieldMapper.java
server/src/main/java/org/elasticsearch/index/mapper/IgnoredSourceFieldMapper.java
Show resolved
Hide resolved
…112963) (#113057) Co-authored-by: Elastic Machine <[email protected]>
Closes #112940.