Add support for parent event field access during iterate_on processing in add_entries processor#6713
Open
yavmanis wants to merge 1 commit intoopensearch-project:mainfrom
Open
Conversation
…ries processor Signed-off-by: Manisha Yadav <yavmanis@amazon.com>
1390a5d to
0ba2de5
Compare
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.
Description
This PR addresses two limitations in the
add_entriesprocessor when usingiterate_on:Problem 1: No root-level field access during array iteration
When
iterate_onis configured,value_expressionandformatresolve against the individual array element context. There is no way to reference root-level fields from the event, so expressions like/alert_titlereturn null ifalert_titleexists only at the root.Problem 2:
add_to_element_whenevaluates against root eventThe
add_to_element_whencondition is evaluated against the root event, not the individual array element. This makes per-element conditional logic impossible — e.g., you cannot add a key only to elements whereseverity == "critical".Solution
Fix 1:
disable_root_keys(default:true)When set to
falsewithiterate_on, resolvesvalue_expressionandformatagainst the root event instead of the array element. This allows injecting root-level fields into each element during iteration.Fix 2:
evaluate_when_on_element(default:false)When set to
truewithiterate_onandadd_to_element_when, evaluates theadd_to_element_whencondition against each individual array element instead of the root event.Example
Input:
Config:
Output:
Backward Compatibility
Both flags default to values that preserve existing behavior. No existing constructors, tests, or functionality are modified.
Default values for the flags:
Issues Resolved
Resolves #6609
Check List
--signoffBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.