2 years ago
#76598
solick
query array of measurement from influxdb 2
obviously I don't understand the new Flux language approach in influxdb2.
What I have:
A running influxdb1 instance where I write a json with different values for a measurement.
Now I have upgraded this influxdb to version 2. I can see in the UI the data and I can create queries where I fetch one of the values from a measurement.
But I have no clue how to fetch all of the values.
My query in influxdb1 was:
select * from "{my measurement}" ORDER BY time DESC LIMIT 500;
which have me the latest 500 measurement entries in an json array which I could use.
How can this be done with Flux now in influxdb2?
I tried something like this:
'from(bucket: "{my bucket}")',
' |> range(start: -1d)',
' |> filter(fn: (r) => r._measurement == "{my measurement}")',
' |> mean()',
' |> yield(name: "_results")';
but I get the following error:
{"code":"invalid","message":"error in building plan while starting program: cannot submit unbounded read to \"{my bucket}\"; try bounding 'from' with a call to 'range'"}"
I am using a range parameter so I don't understand what is the problem with this query...
influxdb-2
flux-influxdb
0 Answers
Your Answer