Skip to content

Commit 7c5d368

Browse files
committed
Added the order by to be applied to the search results even if the order by is part of an aggregation
1 parent 20cea80 commit 7c5d368

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/java/org/nlpcn/es4sql/query/AggregationQueryAction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ public SqlElasticSearchRequestBuilder explain() throws SqlParseException {
9090
break;
9191
case "KEY":
9292
termsBuilder.order(Terms.Order.term(isASC(order)));
93+
// add the sort to the request also so the results get sorted as well
94+
request.addSort(order.getName(), SortOrder.valueOf(order.getType()));
9395
break;
9496
case "FIELD":
9597
termsBuilder.order(Terms.Order.aggregation(order.getName(), isASC(order)));

0 commit comments

Comments
 (0)