Address PR feedback

pull/1642/head
noramullen1 2020-10-12 17:31:58 -07:00
parent d09f510be2
commit 715ea048be
1 changed files with 49 additions and 16 deletions

View File

@ -51,7 +51,7 @@ Delete data from buckets you've created. You cannot delete data from system buck
Use the `influx` CLI or the InfluxDB API `/delete` endpoint to delete data. Use the `influx` CLI or the InfluxDB API `/delete` endpoint to delete data.
{{% note %}} {{% note %}}
The `-p, --predicate` flag is supported in InfluxDB Cloud and InfluxDB OSS 2.0 beta 16 or earlier. The `-p, --predicate` flag is supported in **InfluxDB Cloud** and **InfluxDB OSS 2.0 beta 16 or earlier**.
In InfluxDB OSS 2.0rc0, the `influx delete --predicate` flag has been disabled. In InfluxDB OSS 2.0rc0, the `influx delete --predicate` flag has been disabled.
{{% /note %}} {{% /note %}}
@ -61,15 +61,27 @@ In InfluxDB OSS 2.0rc0, the `influx delete --predicate` flag has been disabled.
1. Use the [`influx delete` command](/influxdb/v2.0/reference/cli/influx/delete/) to delete points from InfluxDB. 1. Use the [`influx delete` command](/influxdb/v2.0/reference/cli/influx/delete/) to delete points from InfluxDB.
2. Specify your organization, bucket, and authentication token. 2. Specify your organization, bucket, and authentication token.
3. Define the time range to delete data from with the `--start` and `--stop` flags. 3. Define the time range to delete data from with the `--start` and `--stop` flags.
4. Specify which points to delete using the `--predicate` or `-p` flag and 4. (InfluxDB Cloud only) Specify which points to delete using the predicate parameter and [delete predicate syntax](/influxdb/v2.0/reference/syntax/delete-predicate/).
[Delete predicate syntax](/influxdb/v2.0/reference/syntax/delete-predicate/).
### Example delete commands
**InfluxDB OSS 2.0rc0** does not support the `predicate` parameter.
#### Delete data in InfluxDB Cloud
##### Example delete command
```sh ```sh
influx delete -o my-org -b my-bucket -t $INFLUX_TOKEN \ influx delete -o my-org -b my-bucket -t $INFLUX_TOKEN \
--start '1970-01-01T00:00:00.00Z' \  --start '1970-01-01T00:00:00.00Z' \
--stop '2020-01-01T00:00:00.00Z' \  --stop '2020-01-01T00:00:00.00Z' \
--predicate '_measurement="sensors" and sensorID="abc123"'  --predicate '_measurement="sensors" and sensorID="abc123"'
```
#### Delete data in InfluxDB OSS
```sh
influx delete -o my-org -b my-bucket -t $INFLUX_TOKEN \
 --start '1970-01-01T00:00:00.00Z' \
 --stop '2020-01-01T00:00:00.00Z' \
``` ```
{{% warn %}} {{% warn %}}
@ -78,6 +90,11 @@ timestamps between the specified `--start` and `--stop` times in the specified b
{{% /warn %}} {{% /warn %}}
## Delete data using the API ## Delete data using the API
{{% note %}}
The `influx` CLI is installed with InfluxDB OSS. If you're using InfluxDB Cloud and haven't already, download the [`influx` CLI](/influxdb/v2.0/get-started/#optional-download-install-and-use-the-influx-cli).
{{% /note %}}
1. Use the InfluxDB API `/delete` endpoint to delete points from InfluxDB. 1. Use the InfluxDB API `/delete` endpoint to delete points from InfluxDB.
2. Include your organization and bucket as query parameters in the request URL. 2. Include your organization and bucket as query parameters in the request URL.
3. Use the `Authorization` header to provide your InfluxDB authentication token. 3. Use the `Authorization` header to provide your InfluxDB authentication token.
@ -85,18 +102,34 @@ timestamps between the specified `--start` and `--stop` times in the specified b
Specify which points to delete using the `predicate` and Specify which points to delete using the `predicate` and
[Delete predicate syntax](/influxdb/v2.0/reference/syntax/delete-predicate/). [Delete predicate syntax](/influxdb/v2.0/reference/syntax/delete-predicate/).
##### Example delete request ### Example delete requests
**InfluxDB OSS 2.0rc0** does not support the `predicate` parameter.
#### Delete data in InfluxDB Cloud
```sh ```sh
curl -XPOST http://localhost:8086/api/v2/delete/?org=myOrg&bucket=myBucket \ curl -X POST 'https://us-west-2-1.aws.cloud2.influxdata.com/api/v2/delete?orgID=<ORGID>'
-H 'Authorization: Token <YOURAUTHTOKEN>' \ -H 'Authorization: Token <TOKEN WITH WRITE PERMISSIONS'
-d '{ -H 'Content-Type: application/json'
"start": "1970-01-01T00:00:00.00Z", -d '{
"stop": "2020-01-01T00:00:00.00Z", "predicate": "_measurement=\"<MEASUREMENT NAME>\" and _field=\"<FIELD>\"",
"predicate": "_measurement=\"sensors\" and sensorID=\"abc123\"" "start": "2020-08-16T08:00:00Z",
}' "stop": "2020-08-17T08:00:00Z"
}'
``` ```
_For more information, see the [`/delete` API documentation](/influxdb/v2.0/api/#/paths/~1delete/post)._ #### Delete data in InfluxDB OSS
```sh
curl -XPOST http://localhost:8086/api/v2/delete/?org=myOrg&bucket=myBucket \
-H 'Authorization: Token <YOURAUTHTOKEN>' \
-d '{
"start": "1970-01-01T00:00:00.00Z",
"stop": "2020-01-01T00:00:00.00Z"
}'
```
_For more information, see the [`/delete` API documentation](/influxdb/v2.0/api/#/paths/~1delete/post)._
{{% warn %}} {{% warn %}}
Using the `/delete` endpoint without a `predicate` deletes all data with Using the `/delete` endpoint without a `predicate` deletes all data with