Update multiple field values matching a condition in InfluxDB

后端 未结 2 1082
星月不相逢
星月不相逢 2021-01-17 01:35

In an InfluxDB measurement, how can the field values of points matching a query be updated? Is this still not easily doable as of v1.6?

As the example in that GitHub

相关标签:
2条回答
  • Q: How can the field values of points matching a query be updated? Is this still not easily doable as of v1.4?

    A: From the best of my knowledge, there isn't an easy way to accomplish update in version 1.4 yet.

    Field value of a point can only be updated by overriding. That is, to overwrite its value you'll need to know the details of your points. These details include its timestamp and series information, which is the measurement it reside and its corresponding tags.

    Note: This "update" strategy can only be used for changing the field value but not tag value. To update a tag value you'll need to first DELETE the point data first and rewrite the entire point data with the updated tag and value.

    Q: Anything better than driving it all from the client by updating individual points?

    A: Influxdb supports multi-point write. So if you can build a filter to pre-select a small dataset of points, modify their field values and then override them in bulk.

    0 讨论(0)
  • 2021-01-17 02:07

    Update is possible and would take the format:

    INSERT measurement,tag_name=tag_value_no_quotes value_key_1=value_value_1,value_key_2=value_value_2 time

    for example where I want to update the line with tag my_box at time 1526988768877018669 on the box measurement:

    INSERT box,box_name=my_box item_1='apple',item_2='melon' 1526988768877018669

    0 讨论(0)
提交回复
热议问题