Design influxDB v2.1 bucket scheme

I work on a project where I have multiple measuring devices (with various types of sensors on one measuring device) in multiple locations.

I am using influxDB v2.1 and I desing my bucket where I am writing data into _measurements.

Location(tag)| Device(tag)|   _field    |
-------------|------------|-------------|
location A   | device1    |device1_temp |
location B   | device2    |device1_press| 
...

So now If I want to delete device1_temp from _field this is no longer available in version 2. So this Query will not work

influx delete --bucket db --start 2022-05-04T00:00:00Z --stop 2022-05-06T00:00:00Z --predicate '_measurement="sensors" AND _field="device1_temp"'

Instead of this query I have to delete data by tag

influx delete --bucket db --start 2022-05-04T00:00:00Z --stop 2022-05-06T00:00:00Z --predicate '_measurement="sensors" AND device="device1"'

BUT this will delete all measurements from other sensors installed on this device1

My question is what is the best approach to be able to delete exact measurements from device sensor’s. What is the best approach to design influxDB v2 bucket schema?

I know about retention policy and this bucket has persistent data so no retention policy is applied.

Why will it delete all measurements from other sensors? Why not just from measurement == sensors? I believe the purpose of the predicate flag:

You can also delete points by field:

This query in cli for influxdb 2.1 will not work

influx delete --bucket db --start 2022-05-04T00:00:00Z --stop 2022-05-06T00:00:00Z --predicate '_measurement="sensors" AND _field="device1_temp"'

I will not be able to delete points using _field because this feature is deprecated if I understand it correctly.

What about this:

influx delete --bucket “db” --start 2022-05-04T00:00:00Z --stop 2022-05-06T00:00:00Z --predicate “_measurement=“sensors” AND _field=“device1_temp””

The single apostrophe did not work for me. :man_shrugging:t2:

It will not delete data by _field with this query