I have a number of users (organizations), each with their own devices (buckets), each with a number of components (points) writing into InfluxDB. In principle, I’d like to ask the question “Give me all readings of type ____ within geographic bounding box _____ from within the last ______ hours that I have permission to view.” I’m trying to learn whether this is possible within Flux, or whether I’ll need to implement a Postgres cache that periodically updates.
Suppose for example I had data that looks like:
{"point": "GPS", "field": "latitude", "value": 1, "time": "2022-01-01T01:00:00"}
{"point": "GPS", "field": "longitude", "value": 2, "time": "2022-01-01T01:00:00"}
<...snip...>
{"point": "THERMOMETER", "field": "temperature_C", "value": 3, "time": "2022-01-01T02:00:00"}
Is it possible to write a Flux query that would allow me to retrieve temperature_C where the last-known latitude and longitude was within some range?