Delete Points from Influx

Hello,
sorry to bother here, but I was not able to find docs related to deleting of points inside influx…
is there really an option to delete the points from the influx.

I have a tag like deviceId, and I want to delete all the points with that tag.

Thanks,

Hi @santhosh

Here is the docs. You can either use ‘drop series, measurement features or delete feature’

DELETE WHERE time < sometime AND "tag_name" = 'tag_value'

Hi @Mert, i’m using v2 and using this client library @influxdata/influxdb-client do you know how to the same using this library GitHub - influxdata/influxdb-client-js: InfluxDB 2.0 JavaScript client .
I’m actually new to influx not sure what to do

i used this library to call the api @influxdata/influxdb-client-apis, by using this we can delete points by this code

const influxDB = new InfluxDB({url, token, timeout});
const deleteAPI = new DeleteAPI(influxDB);


// const healthAPI = new HealthAPI(influxDB);
// healthAPI
//   .getHealth()
//   .then((result /* : HealthCheck */) => {
//     console.log(JSON.stringify(result, null, 2))
//     console.log('\nHealth:', result.status === 'pass' ? 'OK' : 'NOT OK')
//     console.log('\nFinished success')
//   })
//   .catch(error => {
//     console.error(error)
//     console.log('\nFinished ERROR')
//   })



async function deleteDevice(deviceId){
    try{
        const result = await deleteAPI.postDelete({
            body: {
                start : moment().subtract(1,'year').toISOString(),
                stop : moment().toISOString(),
                predicate : `deviceId="${deviceId}"`
            },
            org : org,
            bucket : bucket
        })
        console.log(JSON.stringify(result, null, 2))
        console.log(result);
    }catch(e){
        console.error(e)
    }
}

module.exports = {
    deleteDevice
}

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.