docs-v2/content/flux/v0.x/stdlib/influxdata/influxdb/v1/fieldkeys.md

1.9 KiB

title description menu weight flux/v0.x/tags aliases related introduced deprecated
v1.fieldKeys() function The `v1.fieldKeys()` function returns field keys in a bucket.
flux_0_x_ref
name parent
v1.fieldKeys v1
301
metadata
/influxdb/v2.0/reference/flux/functions/influxdb-v1/fieldkeys
/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys/
/influxdb/cloud/reference/flux/stdlib/influxdb-v1/fieldkeys/
/{{< latest "influxdb" >}}/query-data/flux/explore-schema/
/{{< latest "influxdb" "v1" >}}/query_language/explore-schema#show-field-keys, SHOW FIELD KEYS in InfluxQL
0.68.0 0.88.0

{{% warn %}} v1.fieldKeys() was deprecated in Flux v0.88.0 in favor of schema.fieldKeys(). {{% /warn %}}

The v1.fieldKeys() function returns [field keys](/{{< latest "influxdb" >}}/reference/glossary/#field-key) in a bucket. The return value is always a single table with a single column, _value.

import "influxdata/influxdb/v1"

v1.fieldKeys(
    bucket: "example-bucket",
    predicate: (r) => true,
    start: -30d,
)

Parameters

bucket

The bucket to list field keys from.

predicate

The predicate function that filters field keys. Default is (r) => true.

start

The oldest time to include in results. Default is -30d.

Relative start times are defined using negative durations. Negative durations are relative to now. Absolute start times are defined using time values.

Examples

import "influxdata/influxdb/v1"

v1.fieldKeys(bucket: "my-bucket")

Function definition

package v1

fieldKeys = (bucket, predicate=(r) => true, start=-30d) =>
  tagValues(bucket: bucket, tag: "_field", predicate: predicate, start: start)

Used functions: [v1.tagValues]((/flux/v0.x/stdlib/influxdata/influxdb/v1/tagvalues/)