简体   繁体   中英

Why does InfluxDB return a List of Results on Query

Im using InfluxDB v1.8.6 with the java client. And I use the following code to make queries to the database:

    public List<Result> query(String aQuery){
        Query queryObject = new Query(aQuery,this.dbName);
        QueryResult queryResult = this.influxDB.query(queryObject);
        List<Result> resultList = queryResult.getResults();
        return resultList;
    }

The thing is I know QueryResult.getResults() is supposed to return a List of Results but I've never made a single query that could return more than one result and I cant see how it could. This is annoying because to get my Series object I always have to iterate resultList even when I know it returns a single Result.

My question is, is there a way to utilize the fact that InfluxDB.query() can return more than one result? What query would return more than one result? I've read the documentation but I haven't found a way to return more than one Result on a single query. I dont know if it matters but im using InfluxQL to write the queries and not Flux.

Thank you very much!

Just for the record, I think I found the answer. You can send multiple queries at once: https://docs.influxdata.com/influxdb/v1.7/guides/querying_data/#multiple-queries

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM