2.8 KiB
title | description | menu | weight | flux/v0.x/tags | aliases | related | introduced | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
schema.fieldKeys() function | The `schema.fieldKeys()` function returns field keys in a bucket. |
|
301 |
|
|
|
0.88.0 |
The schema.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/schema"
schema.fieldKeys(
bucket: "example-bucket",
predicate: (r) => true,
start: -30d,
)
{{% note %}}
Deleted fields
Fields deleted from InfluxDB Cloud using the /api/v2/delete
endpoint or the influx delete
command
do not appear in results.
Expired fields
- InfluxDB Cloud: field keys associated with points outside of the bucket's retention policy may appear in results up to an hour after expiring.
- InfluxDB OSS: field keys associated with points outside of the bucket's retention policy may appear in results. For more information, see [Data retention in InfluxDB OSS](/{{< latest "influxdb" >}}/reference/internals/data-retention/). {{% /note %}}
Parameters
bucket
Bucket to list field keys from.
predicate
Predicate function that filters field keys.
Default is (r) => true
.
start
Earliest 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.
stop
Latest time to include in results.
Default is now()
.
The stop
time is exclusive, meaning values with a time equal to stop time are
excluded from results.
Relative start times are defined using negative durations.
Negative durations are relative to now()
.
Absolute start times are defined using time values.
Examples
Return all field keys in a bucket
import "influxdata/influxdb/schema"
schema.fieldKeys(bucket: "example-bucket")
Return all field keys in a bucket from a non-default time range
import "influxdata/influxdb/schema"
schema.fieldKeys(bucket: "example-bucket", start: -90d, stop: -60d)