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
$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”

#CLI
$/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”

#QUERY
$/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

#group,false,false,false,false,true,true,true,true,true,true
#datatype,string,long,dateTime:RFC3339,double,string,string,string,string,string,string
#default,_result,
,result,table,_time,_value,BatCarrier,BatSenKey,BatUlId,BatValid,_field,_measurement
,0,2021-05-23T08:52:26.16Z,9.64,cra,14,50x29196a980,true,BatDecimal,battery_adc
,1,2021-05-23T08:52:26.16Z,20911,cra,14,50x29196a980,true,BatKey,battery_adc

  • 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) }))

nice

i did not read it properly, thank you

pavel