Update multiple field values matching a condition in InfluxDB

后端 未结 2 1098
星月不相逢
星月不相逢 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条回答
  •  不要未来只要你来
    2021-01-17 02:05

    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.

提交回复
热议问题