findRecord() function

The findRecord() function returns a record at a specified index from the first table in a stream of tables where the group key values match the specified predicate. The function returns an empty record if no table is found or if the index is out of bounds.

    fn: (key) => key._field == "fieldName",
    idx: 0,



A predicate function for matching keys in a table’s group key. Expects a key argument that represents a group key in the input stream.


Index of the record to extract.


Input data. Default is piped-forward data (<-).


The following example uses data provided by the sampledata package to show how findRecord() transforms data.

import "sampledata"
    |> findRecord(fn: (key) => key.tag == "t1", idx: 0)
// Returns {_time: 2021-01-01T00:00:00.000000000Z, _value: -2, tag: t1}

Was this page helpful?

Thank you for your feedback!

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.