could you please help me : I cannot filter on tags
I read the documentary but it doesn’t work:
with
from(bucket: “test”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: ® => r["_measurement"] == “testmes”)
|> filter(fn: ® => r["_field"] == “dew” )
i see the tag1 wert
but with filter on tag1 ==“wert”
from(bucket: “test”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: ® => r["_measurement"] == “testmes”)
|> filter(fn: ® => r["_field"] == “dew” and r[“tag1”] == “wert” )
|> keep(columns: ["_time", “_value”, “_field”, “tag1”])
|> sort(columns: ["_time"], desc: false)
i get no result:
the testdata:
testmes,tag1=“wert”,tag2=“wert2” temp=2,dew=3 1585775400
testmes,tag1=“wert”,tag2=“wert3” temp=3,dew=5 1585775800
testmes,tag1=“wert”,tag2=“wert7” temp=4,dew=3 1585776200
testmes,tag1=“wert”,tag2=“wert3” temp=5,dew=7 1585776700
testmes,tag1=“wert”,tag2=“wert5” temp=6,dew=3 1585777100
testmes,tag1=“wert”,tag2=“wert6” temp=4,dew=3 1585778000
Thank you
scott
May 18, 2020, 8:18pm
2
@matthew , in line protocol, whenever you include quotes in a tag value, the quotes are considered part of the actual value. More info here .
To filter by tags as they’re currently formatted, you would have to include, but escape, the quotes in the predicate expression:
// ...
|> filter(fn: (r) => r["_field"] == "dew" and r["tag1"] == "\“wert\”" )
// ...
I’d suggest removing the quotes from the tag values in your line protocol.
testmes,tag1=wert,tag2=wert2 temp=2,dew=3 1585775400
testmes,tag1=wert,tag2=wert3 temp=3,dew=5 1585775800
testmes,tag1=wert,tag2=wert7 temp=4,dew=3 1585776200
testmes,tag1=wert,tag2=wert3 temp=5,dew=7 1585776700
testmes,tag1=wert,tag2=wert5 temp=6,dew=3 1585777100
testmes,tag1=wert,tag2=wert6 temp=4,dew=3 1585778000
Thanks
by the way, the Syntax checker probably doesn’t know any Escapes?
and the line import produces “unequal” number of quotes - - see right side of the screenshot
matthew
scott
May 19, 2020, 2:56pm
4
@matthew That likely is an issue with the syntax checker. I know it’s still in active development, so you may consider submitting an issue to the InfluxDB repo .
It’s interesting that you’re getting extra quotes in your other tags. Is the line protocol you provided the exact line protocol you used to write the data?
i have just deleted the test bucket for testing and read the same data again: yes, the extra quotes have been created again.
the other question is :whether my strings are real ascii - they are created with a windows text editor
scott
May 19, 2020, 5:11pm
6
I’m guessing it is a Windows character encoding issue. InfluxDB 2.0 doesn’t officially support Windows yet. This is something you may consider filing another issue for.
ok … but we re not talking about textprocessing - it was an Editor…
on Linux i check:
/usr/bin/curl -XPOST “http://localhost:9999/api/v2/write?org=private&bucket=test&precision=s ” --header “Authorization: Token secret==”
–data-raw "
testmes,tag1=“wert”,tag2=“wert2” temp=2,dew=3 1585775400
testmes,tag1=“wert”,tag2=“wert3” temp=3,dew=5 1585775800
testmes,tag1=“wert”,tag2=“wert7” temp=4,dew=3 1585776200
testmes,tag1=“wert”,tag2=“wert3” temp=5,dew=7 1585776700
testmes,tag1=“wert”,tag2=“wert5” temp=6,dew=3 1585777100
testmes,tag1=“wert”,tag2=“wert6” temp=4,dew=3 1585778000
"
here all Quotes are automatically deleted …
unfortunately I don’t have a graphic interface in Linux, so I can’t test it with the web interface …