Search code examples
time-seriesinfluxdbdatabasenosql

Force field/tag when inserting data on influxdb


I am just starting with influxdb as a time series database and i was trying to create some measurements, however it seems like influx automatically determines which fields of the measurements are tags and which are fields, is there any way to force one or another at insertion time (first insertion of a measurement)?? or any other way whatsoever?


Solution

  • No, InfluxDB won't automatically determine which are fields and which are tags. Your "insert string" structure "helps InfluxDB in determining which are tags and which are fields.

    For example:

    cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000
    

    In this string, "cpu_load_short" is the measurment name (observe that there is no = sign to form a key/value pair), followed by semi colon.

    host=server01,region=us-west    are tags (in key value formats)
    

    Rignt after tags you can see that there is space, which tells following the space are "Fields".

    You may refer this documentation for more information.