Documentation

bottom() function

Flux 0.7.0+

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

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

Empty tables

bottom() drops empty tables.

Parameters

n

Number of records to return.

columns

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

tables

Input data. Default is piped-forward data (<-).

Examples

The following example uses data provided by the sampledata package to show how bottom() transforms data.

Return rows with the two lowest values

import "sampledata"

sampledata.int()
  |> bottom(n:2)

View input and output

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)

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.