top and bottom

The top and bottom operators list the search results of the most common values for the specified field. The resulting values are listed in tabular format from the highest count value to the lowest.

The fields can be event fields, available in the application menu. If multiple fields are specified, you need to separate the field names with white space or a comma.

top

The top operator provides the most common values for the specified field(s). The values are listed from the highest count value to the lowest.

bottom

The bottom operator provides the least common values for the specified field(s). The values are listed from the lowest count value to the highest. The rare operator can be used as an alias to bottom.

Syntax

…| top [N] field1 [,field2, field3]                           

where:

Aliases that contain special characters have the following syntax restrictions:

Special Characters Restrictions Examples
*, - Do not need to be enclosed in single/double quotes when they are reused and the search works as expected. Destination port <> null | rename Destination Port as 'D*P' | rename Source Port as 'S*P' | top 10 D*P , S*P
@, #, +, ?, /, ^, [], {}, _ , *, ., ~, $, % Do not need to be enclosed in single/double quotes when they are reused and the search works as expected.

Destination port <> null | rename Destination Port as 'D#P' | top D#P

&, ! , = , <, > , +, | Need to be enclosed in single/double quotes when they are reused and the search works as expected. Destination port <> null | rename Destination Port as 'D=P' | top 'D=P'
\

When a backslash is used in an alias name, add an additional backslash \ to escape the character. It does not need to be enclosed in single/double quotes when it is reused and the search runs as expected.

The outcome field name should show only one backslash.

Destination port <> null | rename Destination Port as 'D\\P' | top D\\P

Parameters

The parameters are N and a list of comma-separated fields.

For the top operator, when multiple fields are specified, the count of unique sets for all of the fields is listed from the highest to lowest count. For the bottom operator, the fields are listed from the lowest to the highest count.

How Do I Use This?

The top operator is used to limit the matches to the top N values for the specified fields. Likewise, the bottom operator is used to limit the matches to the bottom N values for the specified fields. The default count number is 500 unless you specify a value for N. Here are a few examples:

For information about other operators, functions, and syntax requirements, see Use an Operator in the Query.