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

Add reverse_nested aggregation #5507

Closed

Conversation

martijnvg
Copy link
Member

PR for #5485

There a number of todos that need to be addressed.

private final Filter parentFilter;
private DocIdSetIterator parentDocs;

// TODO: Should we add LongIntPagedHashMap?
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would make sense. Since all these paged impls are going to be very similar, I'm wondering how we could auto-generate them (just thinking out loud, this would need to be done in a separate change!)

…the next nested object mapping above the nested field specified in the `nested` agg wrapping the reverse_nested agg.

Fail if reverse_nested agg isn't wrapped in a nested agg
Rebased with master
@martijnvg
Copy link
Member Author

Rebased and updated the PR:

  • The reverse_nested agg can only be defined inside a nested agg.
  • The path is an optional option. If not specified the closest nested object field's path from nested agg wrapping the reverse_nested agg is used as path option.

aggregation can break out of the nested block structure and link to other nested structures or the root document,
which allows nesting other aggregations that aren't part of the nested object in a nested aggregation.

For example, lets say we have an index for a ticket system which issues and comments. The commends are inlined into
Copy link
Contributor

Choose a reason for hiding this comment

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

s/commends/comments/

Removed automatic path resolving
If no path is defined then the reverse_nested agg always joins back to the root / main document level.
@martijnvg
Copy link
Member Author

Updated the PR:

  • Moved reverse nested code into the nested package
  • Removed automatic path resolving, because it can unintuitive.
  • If no path has been defined in the reverse_nested agg, it points to the main / root doc. (instead of defining root which can be an actual field)

@jpountz
Copy link
Contributor

jpountz commented Apr 30, 2014

LGTM

martijnvg added a commit that referenced this pull request Apr 30, 2014
The `reverse_nested` aggregation allows to aggregate on properties outside of the nested scope of a `nested` aggregation.

Closes #5507
@martijnvg martijnvg closed this in 013b319 Apr 30, 2014
@martijnvg martijnvg deleted the feature/reverse_nested_agg branch May 18, 2015 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants