Update multiple field values matching a condition in InfluxDB

∥☆過路亽.° 提交于 2019-12-01 14:46:50

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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!