parent
9f6e0dc26e
commit
bb42c7d8a8
|
@ -21,10 +21,21 @@ from an InfluxDB bucket in a specified time range.
|
|||
Select points to delete within the specified time range using [delete predicate syntax](/influxdb/v2.4/reference/syntax/delete-predicate).
|
||||
|
||||
{{% warn %}}
|
||||
#### Deleting data without a delete predicate
|
||||
|
||||
Running `influx delete` without the `-p` or `--predicate` flag deletes all data with timestamps between the specified
|
||||
`--start` and `--stop` times in the specified bucket.
|
||||
|
||||
{{% oss-only %}}
|
||||
|
||||
#### Cannot delete data by field
|
||||
|
||||
InfluxDB {{< current-version >}} does not support deleting data **by field**.
|
||||
|
||||
{{% /oss-only %}}
|
||||
{{% /warn %}}
|
||||
|
||||
|
||||
## Flags
|
||||
| Flag | | Description | Input type | {{< cli/mapped >}} |
|
||||
|:-----|:------------------|:----------------------------------------------------------------------------------------------------------|:----------:|:----------------------|
|
||||
|
|
|
@ -31,9 +31,22 @@ Use [logical operators](#logical-operators) to combine two or more predicate exp
|
|||
```sql
|
||||
key1="value1" AND key2="value"
|
||||
```
|
||||
|
||||
{{% warn %}}
|
||||
With **InfluxDB {{< current-version >}}**, delete predicates can use any column
|
||||
or tag **except** `_time`{{% oss-only %}}, `_field`, {{% /oss-only %}}or `_value`.
|
||||
#### Column limitations when deleting data
|
||||
**InfluxDB {{< current-version >}}** supports deleting data by any column or tag
|
||||
_**except**_ the following:
|
||||
|
||||
- `_time`
|
||||
- {{% oss-only %}}`_field`{{% /oss-only %}}
|
||||
- `_value`
|
||||
|
||||
{{% oss-only %}}
|
||||
|
||||
_InfluxDB {{< current-version >}} does not support deleting data **by field**._
|
||||
|
||||
{{% /oss-only %}}
|
||||
|
||||
{{% /warn %}}
|
||||
|
||||
## Logical operators
|
||||
|
|
|
@ -32,7 +32,8 @@ InfluxDB {{< current-version >}} supports deleting data by the following:
|
|||
{{% oss-only %}}
|
||||
|
||||
{{% warn %}}
|
||||
InfluxDB {{< current-version >}} does not support deleting data by field.
|
||||
#### Cannot delete data by field
|
||||
InfluxDB {{< current-version >}} does not support deleting data **by field**.
|
||||
{{% /warn %}}
|
||||
|
||||
{{% /oss-only %}}
|
||||
|
@ -76,6 +77,10 @@ deletes all data in the specified bucket with timestamps between the specified `
|
|||
|
||||
### Examples
|
||||
|
||||
- [Delete points in a specific measurement with a specific tag value](#delete-points-in-a-specific-measurement-with-a-specific-tag-value)
|
||||
- [Delete all points in a specified time range](#delete-all-points-in-a-specified-time-range)
|
||||
- {{% cloud-only %}}[Delete points for a specific field in a specified time range](#delete-points-for-a-specific-field-in-a-specified-time-range){{% /cloud-only %}}
|
||||
|
||||
##### Delete points in a specific measurement with a specific tag value
|
||||
```sh
|
||||
influx delete --bucket example-bucket \
|
||||
|
@ -91,6 +96,18 @@ influx delete --bucket example-bucket \
|
|||
--stop 2020-11-14T00:00:00Z
|
||||
```
|
||||
|
||||
{{% cloud-only %}}
|
||||
|
||||
##### Delete points for a specific field in a specified time range
|
||||
```sh
|
||||
influx delete --bucket example-bucket \
|
||||
--start 2022-01-01T00:00:00Z \
|
||||
--stop 2022-02-01T00:00:00Z \
|
||||
--predicate '_field="example-field"'
|
||||
```
|
||||
|
||||
{{% /cloud-only %}}
|
||||
|
||||
## Delete data using the API
|
||||
Use the InfluxDB API [`/api/v2/delete` endpoint](/influxdb/v2.4/api/#operation/PostDelete)
|
||||
to delete points from InfluxDB.
|
||||
|
@ -119,6 +136,10 @@ deletes all data in the specified bucket with timestamps between the specified `
|
|||
|
||||
### Examples
|
||||
|
||||
- [Delete points in a specific measurement with a specific tag value](#delete-points-in-a-specific-measurement-with-a-specific-tag-value-1)
|
||||
- [Delete all points in a specified time range](#delete-all-points-in-a-specified-time-range-1)
|
||||
- {{% cloud-only %}}[Delete points for a specific field in a specified time range](#delete-points-for-a-specific-field-in-a-specified-time-range-1){{% /cloud-only %}}
|
||||
|
||||
##### Delete points in a specific measurement with a specific tag value
|
||||
```sh
|
||||
curl --request POST http://localhost:8086/api/v2/delete?org=example-org&bucket=example-bucket \
|
||||
|
@ -142,4 +163,20 @@ curl --request POST http://localhost:8086/api/v2/delete?org=example-org&bucket=e
|
|||
}'
|
||||
```
|
||||
|
||||
{{% cloud-only %}}
|
||||
|
||||
##### Delete points for a specific field in a specified time range
|
||||
```sh
|
||||
curl --request POST http://localhost:8086/api/v2/delete?org=example-org&bucket=example-bucket \
|
||||
--header 'Authorization: Token YOUR_API_TOKEN' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"start": "2022-01-01T00:00:00Z",
|
||||
"stop": "2022-02-01T00:00:00Z",
|
||||
"predicate": "_field=\"example-field\""
|
||||
}'
|
||||
```
|
||||
|
||||
{{% /cloud-only %}}
|
||||
|
||||
_For more information, see the [`/api/v2/delete` endpoint documentation](/influxdb/v2.4/api/#operation/PostDelete)._
|
||||
|
|
Loading…
Reference in New Issue