显然我不理解 influxdb2 中新的 Flux 语言方法。
我有的:
一个正在运行的 influxdb1 实例,我在其中编写了一个具有不同测量值的 json。
现在我已将此 influxdb 升级到版本 2。我可以在 UI 中看到数据,并且可以创建查询,从测量中获取其中一个值。
但我不知道如何获取所有值。
我在 influxdb1 中的查询是:
select * from "{my measurement}" ORDER BY time DESC LIMIT 500;
其中有我可以使用的 json 数组中的最新 500 个测量条目。
现在 influxdb2 中的 Flux 如何做到这一点?
我试过这样的事情:
'from(bucket: "{my bucket}")',
' |> range(start: -1d)',
' |> filter(fn: (r) => r._measurement == "{my measurement}")',
' |> mean()',
' |> yield(name: "_results")';
但我收到以下错误:
{"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'"}"
我正在使用范围参数,所以我不明白这个查询有什么问题......