Skip to content

Aggregations: Adds ability to sort on multiple criteria #7588

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

Merged
merged 1 commit into from
Sep 8, 2014
Merged

Aggregations: Adds ability to sort on multiple criteria #7588

merged 1 commit into from
Sep 8, 2014

Conversation

colings86
Copy link
Contributor

The terms aggregation can now support sorting on multiple criteria by replacing the sort object with an array or sort object whose order signifies the priority of the sort. The existing syntax for sorting on a single criteria also still works.

Contributes to #6917

@@ -239,6 +306,13 @@ public static InternalOrder readOrder(StreamInput in) throws IOException {
return new InternalOrder.Aggregation(key + "." + in.readString(), asc);
}
return new InternalOrder.Aggregation(key, asc);
case -1:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use CompoundOrder.ID instead of -1?

@colings86
Copy link
Contributor Author

@jpountz Didn't realise that you hadn't removed the review tag but have just pushed an update from your feedback. Sorry if that messes things up

public static class CompoundOrderComparator implements Comparator<Terms.Bucket> {

private List<Terms.Order> compoundOrder;
private Aggregator aggregator;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you make them final?

@jpountz
Copy link
Contributor

jpountz commented Sep 5, 2014

LGTM

@jpountz jpountz removed the review label Sep 5, 2014
The terms aggregation can now support sorting on multiple criteria by replacing the sort object with an array or sort object whose order signifies the priority of the sort. The existing syntax for sorting on a single criteria also still works.

Contributes to #6917
@colings86 colings86 merged commit bfedd11 into elastic:master Sep 8, 2014
@colings86 colings86 deleted the feature/multipleSorts branch September 8, 2014 14:22
@colings86 colings86 restored the feature/multipleSorts branch September 8, 2014 19:19
@colings86 colings86 deleted the feature/multipleSorts branch September 8, 2014 19:19
@colings86 colings86 restored the feature/multipleSorts branch September 8, 2014 19:19
@colings86
Copy link
Contributor Author

These changes have been reverted as backward compatibility issues were found. A new PR will be raised when the issues have been resolved

colings86 added a commit that referenced this pull request Sep 15, 2014
The terms aggregation can now support sorting on multiple criteria by replacing the sort object with an array or sort object whose order signifies the priority of the sort. The existing syntax for sorting on a single criteria also still works.

Contributes to #6917
Replaces #7588
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.

3 participants