Sorting is not working


I am trying to sort the result in groupby but it seems it is not working.

Query 1 :


“jsonClass”: “GroupByQuerySpec”,

“queryType”: “groupBy”,

“dataSource”: “test”,

“dimensions”: [{

“jsonClass”: “DefaultDimensionSpec”,

“type”: “default”,

“dimension”: “query”,

“outputName”: “searchterm”


“granularity”: “all”,

“aggregations”: [{

“jsonClass”: “FunctionAggregationSpec”,

“type”: “longSum”,

“name”: “volume”,

“fieldName”: “count”


"OrderByColumnSpecs": {

"dimension": “volume”,

"direction": "descending"


"OrderByColumnSpecs" is not part of the query spec. What you want is
the limitSpec from

And then in your "columns" field on there, you specify the "order by
specs". So something like your second query but replace "orderBy"
with "limitSpec":


This works man. Thanks .