-
Notifications
You must be signed in to change notification settings - Fork 306
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
Remove empty event action params #464
base: main
Are you sure you want to change the base?
Remove empty event action params #464
Conversation
In event_action_params() clean params from nil and empty values - when using dynamic fields (like document_id => "%{[@metadata][document_id]}"), empty or nil values could be produced for document_id and parent fields (in es_bulk metadata part), which is not valid es_bulk metadata format, thus those values should be cleaned.
ebeafcd
to
ccb92b7
Compare
@untergeek @karmi any update? |
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.
Thanks for the patch. I love the idea here. It needs some tweaks though!
expect(params).to include(:_id => "mytestid", :parent => "mytestparent") | ||
end | ||
|
||
it "should interpolate the requested id and parent values and leave them as is (sprintf behavior, not sure if correct one) when they missing" do |
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.
This behavior isn't great, but I don't know what else we can do here. I think this should be documented in the option docs.
expect(params).to include(:_id => "%{myid}", :parent => "%{myparent}") | ||
end | ||
|
||
it "should interpolate the requested id and parent values and leave them as is (sprintf behavior, not sure if correct one) when they empty" do |
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.
This just repeats the previous test. I think you wanted to test that this should interpolate the requested id and parent values.
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.
Yeas, those are two identical tests, just to see the actual difference in behavior what happens when proposed remove_empty_action_params param set to true and to false.
Hey @andrewvc could this be merged? |
In event_action_params() clean params from nil and empty values - when using dynamic fields (like document_id => "%{[@metadata][document_id]}"), empty or nil values could be produced for document_id and parent fields (in es_bulk metadata part), which is not valid es_bulk metadata format, thus those values should be cleaned.
I've added remove_empty_action_params configuration option to control this behavior (default is false).
Test is added as well.