[ Web Proxy ]
URL:
Viewing: https://developers.cloudflare.com/analytics/graphql-api/features/sorting/ [Back]  [Original]

Sorting Cloudflare Analytics docsSkip to content
SearchCtrlKLog in
  1. Home
  2. /Analytics
  3. /
  4. /Features
  5. /Sorting

Sorting

Last updated Apr 23, 2026Copy as MarkdownView as MarkdownAgent setup
OverviewExamplesRaw data sortingRaw data sorting using multiple fieldsGroup sorting by aggregation function

You can specify the order of the query result elements using the orderBy argument. By default, the results are sorted by the primary key of a dataset (table). If you specify another field to sort on, the primary key is also used in the sorting key, allowing results to remain consistent for pagination.

The default order for an aggregated dataset is by the fields on which the aggregated data is grouped. If you specify a different order, the aggregation group is appended to your specified ordering.

Note

Ordering within nested structures is not supported.

Examples

Raw data sorting

firewallEventsAdaptive (orderBy: [clientCountryName_ASC]) {
    clientCountryName
}

Raw data sorting using multiple fields

firewallEventsAdaptive (orderBy: [clientCountryName_ASC, datetime_DESC]) {
    clientCountryName
    datetime
}

Group sorting by aggregation function

httpRequests1hGroups (orderBy: [sum_bytes_DESC]){
    sum {
        bytes
        requests
    }
    dimensions {
        datetime
    }
}
PreviousFilteringNextPagination

Was this helpful?

YesNo
Edit pageReport issue
[]

Web Proxy Viewer  |  New URL  |  Original Page