Count number of measurements of a bucket

I was searching all the documentation (forgive me if I didn’t find it) and I couldn’t find a way to make a request to the database, and it would return, for example, the number of measurements that a bucket has.

Found a related question

influx -database telegraf -execute "show series" | tail -n +3 | awk -F, '{print $1}' | uniq | wc -l

Which gives a solution from flux cli (terminal) which is good information, but generally I want to ask influxdb directly for this information

@AnonymousWebHacker What version of InfluxDB are you using?

For InfluxDB 2 and flux that’s pretty easy to do:

import "influxdata/influxdb/schema"

schema.measurements(bucket: "example-bucket")
|> count()