I’m trying to delete data over a time range specified by a tag and a specific field. My data has a single tag (DataSetId) and about 12 different fields. My example delete predicate looks like:
_field="ROP" AND DataSetId="78b6fdef-6908-4f26-85a2-e61be2f91a6d"
When I remove the field and just leave the DataSetId, it successfully deletes all data from the dataset. Any idea on what I’m missing? Documentation doesn’t indicate there should be any issue with deleting by field.
(Tested in both 2.0.3 and 2.0.4)
I run into the same problem, I can filter by measure and tags, but no field.
I think it’s a bug since the documentation says:
Predicate expressions can use any column or tag except
_field should work.
(I’m running 2.0.3 too)
I have a theory about why it’s not working after a bit more studying of Influx’s storage model. It seems that the delete predicate is intended to delete entire Points (per their documentation,
Use the influx delete command to delete *points* from InfluxDB.), and in Influx, a “Point” can have many _field/_value pairs associated with it. Tags are all defined at the point level, so it follows that deleting points by a Tag is straightforward enough, but if you have multiple fields on your points, the delete predicate will fail to simply delete individual _fields off the points (which I guess is what we’re trying to do).
Our workaround is we’re going to just use different tags in place of _field to ensure all points are uniquely created- delete seems to work with that just fine.
(Someone more familiar with Influx’s model can correct me if any of this is inaccurate; I’m still adjusting my mental model a bit here)
I can follow your argument, I think it makes sense.
Put another way, you are conceptually separating the Point data (fields) from the Point identifiers (measure, tags, value, etc.), isn’t it?
Nonetheless, I think it should be in the documentation, by adding that the column
_field shouldn’t be used.