Schema - Filter fields by specifying a tag

Hi,

Is there a way to filter the output of the functions in the “influxdata/influxdb/schema” package by given tags? I’m currently trying to get all fields of a bucket with a given “_measurement” value and a specific “device” tag value.

This would be the equivalent configuration with the UI (I blured most of the values, but the idea should be clear):

I realized there is already another question similar to my question, but it has not been answered.

Best Regards,

Benjamin

While the “Explore your data schema with flux” page only presents pretty basic use cases, the actual schema.fieldKeys() documentation shows that a predicate function can be specified as an optional argument in the function parameters. After finding the definition and the usage of predicate functions in flux, I added a predicate function to only show fields with a certain “device” tag value:

import "influxdata/influxdb/schema"
schema.fieldKeys(bucket: "example-bucket", predicate: (r) => r.device == "my-device-type")

This solved my problem.

@brimstone
You rock! Thank you for sharing the answer you found <333