I have an InfluxDB 1.8 install running that I have enabled flux for. I have a database named “weather” which has measurements named “conditions” which I’m populating from a local airport feed using Telegraf. From the influx command line I can do use weather, then select * from conditions and see the data I’ve collected.
The tag is called “station_id” and one of the fields is named “wind_string” so I’d like to try a simple POJO query using the influxdb-client-java library.
// already have a connection above
String flux = "from(bucket:\"weather/autogen\") |> range(start: 0) |> filter(fn: (r) => r._measurement == \"conditions\" )";
QueryApi queryApi = influxDBClient.getQueryApi();
List<Conditions> records = queryApi.query(flux, Conditions.class);
for (Conditions conditions : records) {
System.out.println(conditions.time + ": " + conditions.station_id + ": " + conditions.wind_string);
}
as well as:
@Measurement(name = "conditions")
public static class Conditions {
@Column(tag = true)
String station_id;
@Column(name = "wind_string")
String wind_string;
@Column(timestamp = true)
Instant time;
}
I know I’m missing something because the time and station_id print fine, but conditions.wind_string is always null.
Can I get a hint?