Documentation

bottom() function

The bottom() function sorts a table by columns and keeps only the bottom n records.

Function type: Selector
Output data type: Record

bottom(n:10, columns: ["_value"])

Empty tables

bottom() drops empty tables.

Parameters

n

Number of records to return.

Data type: Integer

columns

List of columns by which to sort. Sort precedence is determined by list order (left to right). Default is ["_value"].

Data type: Array of strings

Examples

from(bucket:"example-bucket")
  |> range(start:-1h)
  |> filter(fn: (r) =>
    r._measurement == "mem" and
    r._field == "used_percent"
  )
  |> bottom(n:10)

Function definition

// _sortLimit is a helper function, which sorts and limits a table.
_sortLimit = (n, desc, columns=["_value"], tables=<-) =>
  tables
    |> sort(columns:columns, desc:desc)
    |> limit(n:n)

bottom = (n, columns=["_value"], tables=<-) =>
  _sortLimit(n:n, columns:columns, desc:false)

New! Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: