Documentation

query.filterFields() function

Flux 0.60.0+

The query.filterFields() function is experimental and subject to change at any time. By using this function, you accept the risks of experimental functions.

The query.filterFields() function filters input data by field.

import "experimental/query"

query.filterFields(
  fields: ["exampleField1", "exampleField2"]
)

Parameters

fields

Fields to filter by. Must be exact string matches.

tables

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

Examples

import "experimental/query"

query.fromRange(bucket: "telegraf", start: -1h)
  |> query.filterFields(
    fields: ["used_percent", "available_percent"]
  )

Function definition

package query

filterFields = (tables=<-, fields=[]) =>
  if length(arr: fields) == 0 then
    tables
  else
    tables
      |> filter(fn: (r) => contains(value: r._field, set: fields))

Used functions:
contains()
filter()
length()


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.