Cannot create boolean, still have string

hallo i have no problems to use true/false as string, but since influx supports boolean values i would like to use it. here are my test:

$curl --request POST “https://ruth:8086/api/v2/write?org=foookin_paavel&bucket=ccc&precision=ms” --header “Authorization: Token …” --data-raw “battery_adc,host=spongebob,BatSenKey=14,BatUlId=50x29196a980,BatCarrier=ttn,BatValid=true BatDecimal=7.64,BatKey=20909 1621759946147”

$/usr/bin/docker container exec dck_influxdb influx write -c default --skip-verify -b ccc -p ms “battery_adc,host=spongebob,BatSenKey=14,BatUlId=50x29196a980,BatCarrier=cra,BatValid=true BatDecimal=9.64,BatKey=20911 1621759946160”

$/usr/bin/docker container exec dck_influxdb influx query --skip-verify -c default ‘from(bucket: “ccc”) |> range(start: -24h) |> filter(fn: (r) => r["_measurement"] == “battery_adc”) |> drop(columns: ["_start", “_stop”, “host”])’ --raw


  • but with CURL and CLI a still have tag BatValid as STRING not BOOL

  • as in Line protocol | InfluxDB OSS 2.0 Documentation
    i am not using any quotation mark, but i know influx2 sort this probably by its own as also not using " for string BatUlId

  • before every attemp i flush bucket or just delete it, to test on freshly new one

  • if there is a way i can specify each collumn ( for API_2 via CURL or CLI ) as in CSV import please let me know

thank you, pavel

@srbp You’re currently writing BatValid as a tag and tags can only be strings. InfluxDB supports boolean fields, but not tags (see Value data type under “Tag set” in the Line protocol documentation)

If you need to, you can convert the BatValid column to booleans at query time:

from(bucket: "ccc")
  |> range(start: -24h)
  |> filter(fn: (r) => r["_measurement"] == "battery_adc")
  |> drop(columns: ["_start", "_stop", "host"])
  |> map(fn: (r) => ({ r with BatValid: bool(v: r.BatValid) }))


i did not read it properly, thank you