nkirit
nkirit

Reputation: 389

`missing tag key` when inserting to InfluxDB with inserting with multiple tags

I created a new db mydb on Influxdb. Next I did use mydb When I run insert on my db, I run into error - ERR: {"error":"unable to parse 'angle, userid=1, product=pname value=5.1': missing tag key"}

Here's the insert that I am running - INSERT angle, userid=1, product=dname value=5.1

Upvotes: 2

Views: 13602

Answers (3)

Juan
Juan

Reputation: 41

Currently learning influxdb and my issue was the spaces. Make sure you have the correct spaces.

Your insert command:

INSERT angle, userid=1, product=dname value=5.1

Properly formatted with spaces corrected:

INSERT angle,userid=1,product=dname value=5.1

I would have left a comment beneath the answer but I don't have the reputation for it and no one explicitly mentioned the issue with the spaces. So for any newcomers, pay attention to your spaces.

Upvotes: 3

nkirit
nkirit

Reputation: 389

After checking docs and multiple hit and tries I figured outthe correct way to insert in influxDb with multiple tags is this -

INSERT angle,id=1,product=ineck value=5.0

https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/

Upvotes: 2

Assuming angle is the name of the measurement and userid, product and value are fields, try removing the comma after angle if you are not applying any tags and add another comma before value ?

INSERT angle userid=1,product=dname,value=5.1

If userid is a tag then it should be something like

INSERT angle,userid=1 product=dname,value=5.1

Please refer to line protocol specification
https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_reference/
https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/

Upvotes: 3

Related Questions