Skip to content
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

Scripted_metric _agg parameter disappears if params are provided #19863

Closed
wants to merge 6 commits into from

Conversation

consulthys
Copy link
Contributor

@consulthys consulthys commented Aug 8, 2016

Quick fix to scripted_metric aggregation to provide a more intuitive behavior when params without _agg are being specified.

Closes #19768

@clintongormley clintongormley changed the title Fixes #19768: scripted_metric _agg parameter disappears if params are… Scripted_metric _agg parameter disappears if params are provided Aug 11, 2016
@clintongormley
Copy link
Contributor

@colings86 could you take a look please?

@colings86
Copy link
Contributor

@consulthys Thanks for the PR. Would you be able to add a test to ScriptedMetricIT to test your change?

@consulthys
Copy link
Contributor Author

@colings86 Yes, definitely, I will do this and report when done.

@elasticmachine
Copy link
Collaborator

Can one of the admins verify this patch?

@consulthys
Copy link
Contributor Author

I've (finally) committed a test case for this PR. Sorry it took so long.

@s1monw
Copy link
Contributor

s1monw commented Jan 25, 2017

@elasticmachine test this please

Copy link
Contributor

@s1monw s1monw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a minor comment LGTM otherwise

@@ -67,6 +67,8 @@ public Aggregator createInternal(Aggregator parent, boolean collectsFromSingleBu
params = deepCopyParams(params, context);
} else {
params = new HashMap<>();
}
if (!params.containsKey("_agg")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one minor thing, we try to be consistent and don't use ! to negate a boolean. Yet we try to use == false since it's easier to read ! is easy to miss. Would you make that change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I missed that, of course, I'll do it

@s1monw
Copy link
Contributor

s1monw commented Jan 25, 2017

@consulthys thanks for fixing the comment so quickly. I will wait for CI and pull it in afterwards.

@s1monw
Copy link
Contributor

s1monw commented Jan 25, 2017

@elasticmachine test this please

@consulthys
Copy link
Contributor Author

@simonw for some reason I pushed the wrong version of the test case, sorry about that.

@s1monw
Copy link
Contributor

s1monw commented Jan 25, 2017

@elasticmachine ok to test

@s1monw
Copy link
Contributor

s1monw commented Jan 26, 2017

@elasticmachine test this please

@s1monw
Copy link
Contributor

s1monw commented Jan 26, 2017

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

1 similar comment
@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@rjernst
Copy link
Member

rjernst commented Jun 9, 2017

@consulthys Are you still interested in getting this PR merged? The test you added fails on your final assert of the method, on the total count equaling the number of docs.

@consulthys
Copy link
Contributor Author

Yes, I'm still interested. I got sidetracked, I will put this back onto the stack.

@dakrone
Copy link
Member

dakrone commented Aug 15, 2017

@consulthys ping again on this, are you still interested in this PR?

@consulthys
Copy link
Contributor Author

@dakrone Yes, I am, sorry for the delay

@reeselevine
Copy link
Contributor

This would be very helpful, any update on this?

@rjernst
Copy link
Member

rjernst commented Oct 9, 2017

@consulthys I'm going to close this PR for now as it appears stalled. Please reopen when/if you have time to bring it up to date and fix the test.

@rjernst rjernst closed this Oct 9, 2017
@reeselevine
Copy link
Contributor

@rjernst @consulthys would you be opposed if I went ahead and fixed this so it can (hopefully) get merged in?

@rjernst
Copy link
Member

rjernst commented Oct 23, 2017

@reeselevine please do open a new PR!

@consulthys
Copy link
Contributor Author

@reeselevine Please feel free to do this in a new PR.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scripted_metric _agg parameter disappears if params are provided
9 participants