我正在将InfluxDB与Grafana一起使用,并且我items
使用一些标签和一个名为itemType
. 我需要过滤itemType
特定字符串的行。以下 InfluxQL 查询正是我需要的:
SELECT * FROM "items" WHERE "itemType" = 'example'
我怎样才能在Flux中做同样的事情?
我目前有以下查询,除了按字段过滤之外,它执行所有操作:
from(bucket: "dbname/autogen")
|> range(start: 2020-10-12T01:56:34Z, stop: 2020-10-12T02:54:10Z)
|> filter(fn:(r) => r._measurement == "items")
|> aggregateWindow(every: 5m, fn: count)
但是将filter
函数替换为filter(fn:(r) => r._measurement == "items" and r.itemType == "example")
不返回任何结果,即使上面的 InfluxQL 查询在 InfluxDB CLI 中使用时确实返回数据。