sort

This command is experimental

Definition

sort sorts defines how the results are sorted out.

Available sorting options are:

Examples

You can sort the dataset by using sort with the name of table column you want to sort.

%dpl
index=example | sort _raw
the simpliest sort example

Sorting Order

The default sorting order is ascending. You can use desc to change the sorting order to descending.

%dpl
index=example | sort _raw desc
descending example

You can also use + or - with table column names to define the sorting order.

Use + for ascending order.

%dpl
index=example | sort + _raw desc

Use - for descending order.

%dpl
index=example | sort - _raw desc

Sorting Options

auto

auto sorting option automatically sorts the results.

%dpl
index=example | sort auto(_raw)
example of auto sort

ip

ip sorting option interprets selected values as IP addresses.

%dpl
index=crud_small
| spath
| sort ip(ipaddress)
example of ip sort

num

num sorting option interprets selected values as numbers.

%dpl
index=example | sort num(_raw)
example of num sort

str

str sorting option interprets selected values as strings and orders them alphabetically.

%dpl
index=crud_small
| spath
| sort str(operation)
example of str sort

Count

You can limit the amount of results by adding limit or a plain integer before the table column’s name.

If the count isn’t specified or the value is 0, sort will show 5 000 results by default.

%dpl
index=example | sort 7 _raw
first count example
%dpl
index=example | sort limit=7 _raw
second count example

Further Reading