Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/search/search-query-language/search-operators/sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ sidebar_label: sort

The `sort` operator orders aggregated search results. The default sort order is descending. Then you can use the top or limit operators to reduce the number of sorted results returned.

Order is also synonymous with sort. You can use them interchangeably in your queries.
The `order` operator is synonymous with the `sort` operator. You can use them interchangeably in your queries.

## Syntax

```sql
sort by <field> (displays results as descending, by default)
```

```sql
order by <field> (displays results as descending, by default)
```

```sql
sort by +<field> (displays results as ascending)
```
Expand Down Expand Up @@ -51,6 +55,11 @@ status AND down | extract "user=(?<user>.*?):" | count (*) group by user | sort
... | count user | sort by _count asc
```

```sql
| parse "GET * " as url | count by url | order by _count
| order by _count asc
```

### Top 10 pages by page hits

This example counts page hits by sourceHost, sorts them by page hits, and limits the results to the top 10.
Expand Down
Loading