Add an ignoreMissing parameter to IngestDocument's removeField method#125232
Merged
joegallo merged 3 commits intoelastic:mainfrom Mar 19, 2025
Merged
Conversation
Collaborator
|
Pinging @elastic/es-data-management (Team:Data Management) |
parkertimmins
approved these changes
Mar 19, 2025
Collaborator
💚 Backport successful
|
elasticsearchmachine
pushed a commit
that referenced
this pull request
Mar 19, 2025
smalyshev
pushed a commit
to smalyshev/elasticsearch
that referenced
this pull request
Mar 21, 2025
Contributor
Author
Here's a screenshot from the nightly benchmarks -- there's a very nice decrease in the time spent in |
joegallo
added a commit
to joegallo/elasticsearch
that referenced
this pull request
Mar 25, 2025
omricohenn
pushed a commit
to omricohenn/elasticsearch
that referenced
this pull request
Mar 28, 2025
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

And use it in the
removeprocessor.Related to #123891, and also this is a follow up to #124322 and #125051 (earlier nearby PRs that were laying the groundwork for this change).
Prior to this change, we had to traverse the document tree twice in the
removeprocessor for each field that we wanted to remove: once to check whether the field existed (in thehasFieldcall), and then once to actually remove the field (in theremoveFieldcall). This was necessary becauseremoveFieldwould throw an exception if the field didn't exist, so the call had to be guarded. By adding anignoreMissingparameter toremoveFieldwe can remove thehasField-guarding and just specify that we don't care if the field doesn't exist (well, assumingignore_missinghas been set totrueon the processor itself, which it typically is in the wild).I'm labeling this as a
>refactoringsince there's no user-visible change in behavior, I'm just twiddling the code a bit so that it happens to be faster. On which note, this speeds up theremoveprocessor by 30% -- I'm seeing that it's taking 290 microseconds per document rather than 413 onmain(a further note: prior to #120573 it was taking 681 microseconds per document for the same benchmark).