Search code examples
influxdb

How to check that tag exists in InfluxDB bucket?


I am using bitcoin sample data, for example, and do the query in InfluxDB notebook UI like this:

import "influxdata/influxdb/schema"
schema.tagKeys(bucket: "bitcoin")

This works good. But then I want to find specific tag by its name. I suppose following should work but doesn't:

schema.tagKeys(bucket: "bitcoin", predicate: (r) => r._value == "code")

I see error: An internal error has occurred - check server logs. And the following string in logs:

ts=2023-06-05T08:50:06.835733Z lvl=warn msg="internal error not returned to client" log_id=0iB3ypUW000 handler=error_logger error="field values unsupported"

I'm not sure what does it mean.

I also tried to check if _value is valid property name and it is like so:

schema.tagKeys(bucket: "bitcoin", predicate: (r) => exists r._value)

above returns all 8 rows with tags names.

How can I find tag by its name? thanks


Solution

  • I've found the way to filter it like this

    schema.tagKeys(bucket: "bitcoin")
      |> filter(fn: (r) => r._value == "code")