Influxdb: Allow field value data types to be changed

Created on 24 May 2015  路  5Comments  路  Source: influxdata/influxdb

I'm trying to set this data

{"database":"3c330599-0b11-5ca8-0a43-00006fcddc83","time":"2015-05-23T07:24:00Z","points":[{"name":"access_log","fields":{"IPADDR":"192.168.1.164","SIZE":126064,"SITE":"mail.articatech.com","FAMILYSITE":"articatech.com","RQS":1,"ZDATE":1432358640}}]}

Receive this error

- 500 - {"error":"field \"SIZE\" is type string, mapped as type string"}

When adding quotes in SIZE, it is working ( "SIZE":"126064")
How to force influxdb to understand that SIZE field is an integer value ?

RFC arequeries internal kinfeature-request

Most helpful comment

This is one of the most immensely annoying "features" of InfluxDB.

All 5 comments

There is currently no way to change the data type of a field. The error strongly suggests that the first value written to SIZE was a string, not an integer. As such, all subsequent values must be strings. From http://influxdb.com/docs/v0.9/concepts/reading_and_writing_data.html#schemaless-design:

"If you attempt to write data with a different type than previously used (for example writing a string to a tag that previously accepted integers), InfluxDB will reject the data."

The simplest workaround is probably to define a new field on the series, something like size_int.

I'm going to change this into a feature request to allow changing data types, as this is not a bug but rather a limitation of the current design.

I do not believe we'll be able to do this. If you want to change which type you use, you can use a new field name, use a new retention policy, or you can wait for a new shard to be created and drop the old shards.

I'm going to close this. We may consider revisiting this in the future so please open a new issue if this is something that is still needed. Thanks.

This is one of the most immensely annoying "features" of InfluxDB.

I'm using influx 1.7.1, I accepted to lose my data with "DROP MEASUREMENT X" yet SOW FIELD KEYS FROM X still shows the old fielkeys and types.
Is this sticky type on empty measurement also intended by design ?

I had the same problem.
My dirty hack:

  1. Stopped all write to influxdb.
  2. influx_inspect export -database telegraf -datadir /var/lib/influxdb/data -waldir /var/lib/influxdb/wal -out myfile
  3. Used sed to delete the " from values in myfile to myfile_1.
  4. DROP DATABASE telegraf
  5. influx -import -path=myfile_1
  6. Start input to influxdb with the right file type.

It act.

I agree to TotallyInformation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shilpapadgaonkar picture shilpapadgaonkar  路  3Comments

affo picture affo  路  3Comments

udf2457 picture udf2457  路  3Comments

dandv picture dandv  路  3Comments

allenbunny picture allenbunny  路  3Comments