Can we do 'like' operations in influxdb using flux

influxql
influxdb
#1

Is there a way I can use like operator in flux or influxql.

Ex:

          from(bucket: "Stock/autogen")  
           |> range(start: dashboardTime)
           |> filter(fn: (r) => 
           	r._measurement == "StockLocations" and
                 r.LOC like "%NYC%"
           )
          |>window(every:15m)
          |>first()

Or using InfluxQL,
Select * from StockLocations where time >= now() - 15s and LOC like '%NYC%'

#2

There are no like operators, but we can use Regex to do the same.

Using InfluxQL:
Select * from StockLocations where time >= now() - 15s and Path =~ /NYC/

Using Flux:

           |> range(start: dashboardTime)
           |> filter(fn: (r) => 
           	r._measurement == "StockLocations" and
                 r.LOC =~/NYC/
           )
          |>window(every:15m)
          |>first()
1 Like