contains() function

The contains() function tests whether a value is a member of a set. If the value is a member of the set, the function returns true. If the value is not a member of the set, the functions returns false.

  1. contains(
  2. value: 1,
  3. set: [1,2,3]
  4. )

Parameters

value

The value for which to search.

*Data type: Boolean | Integer | UInteger | Float | String | Time*

set

The set of values in which to search.

*Data type: Array of Booleans | Integers | UIntegers | Floats | Strings | Times*

Examples

Filter on a set of specific fields
  1. fields = ["load1", "load5", "load15"]
  2. from(bucket: "example-bucket")
  3. |> range(start:start, stop: stop)
  4. |> filter(fn: (r) =>
  5. r._measurement == "system" and
  6. contains(value: r._field, set: fields)
  7. )