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

Allow nested fields in the composite aggregation #37178

Merged
merged 5 commits into from
Jan 25, 2019

Conversation

jimczi
Copy link
Contributor

@jimczi jimczi commented Jan 7, 2019

This changes adds the support to handle nested fields in the composite
aggregation. A nested aggregation can be used as parent of a composite
aggregation in order to target nested fields in the sources.

Closes #28611

This changes adds the support to handle `nested` fields in the `composite`
aggregation. A `nested` aggregation can be used as parent of a `composite`
aggregation in order to target `nested` fields in the `sources`.

Closes elastic#28611
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo

@polyfractal polyfractal self-requested a review January 15, 2019 14:06
Copy link
Contributor

@polyfractal polyfractal left a comment

Choose a reason for hiding this comment

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

LGTM, sorry for the delay!

if (parent != null) {
throw new IllegalArgumentException("[composite] aggregation cannot be used with a parent aggregation");
AggregatorFactory<?> invalid = checkParentIsNullOrNested(parent);
if (invalid != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, what scenario might trigger this now that nested is supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you add a parent other than a nested aggregator. So for instance a terms aggregation cannot use a composite aggregation as a sub-aggregation.

@jimczi jimczi merged commit cb451ed into elastic:master Jan 25, 2019
@jimczi jimczi deleted the composite_with_nested_parent branch January 25, 2019 13:00
jimczi added a commit that referenced this pull request Jan 25, 2019
This changes adds the support to handle `nested` fields in the `composite`
aggregation. A `nested` aggregation can be used as parent of a `composite`
aggregation in order to target `nested` fields in the `sources`.

Closes #28611
@krishan-21723
Copy link

why can't it support all kinds of aggregators as parent ?

juliovalcarcel added a commit to juliovalcarcel/elasticsearch that referenced this pull request Feb 13, 2019
A composite aggregation should be allowed to be a grandchild of a nested
aggregation only if it's parent is a filter aggregation.

Relates to elastic#37178
@edoquiros
Copy link

edoquiros commented Feb 17, 2020

Starting on which version is this feature available?

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.

composite aggregation as child aggregation
6 participants