Flushing buckets

To flush all buckets, use the POST /pools/default/buckets/default/controller/doFlush HTTP method and URI.

Description

The doFlush operation empties the contents of the specified bucket, deleting all stored data. The operation only succeeds if flush is enabled on configured bucket.

Warning: This operation is data destructive. The service makes no attempt to confirm or double check the request. Client applications using this are advised to double check with the end user before sending such a request. You can control and limit the ability to flush individual buckets by setting the flushEnabled parameter on a bucket in Couchbase Web Console or via cbepctl flush_param.

Parameters and payload data are ignored, but the request must including the authorization header if the system has been secured.

Important: The flush request may lead to significant disk activity as the data in the bucket is deleted from the database. The high disk utilization may affect the performance of your server until the data has been successfully deleted.
Note: The flush request is not transmitted over XDCR replication configurations;. The remote bucket is not flushed.

Couchbase Server returns a HTTP 404 response if the URI is invalid or if it does not correspond to an active bucket in the system.

HTTP method and URI

POST /pools/default/buckets/default/controller/doFlush

Syntax

Curl request syntax:

curl -X POST -u [admin]:[password]
  http://[localhost]:8091/pools/default/buckets/default/controller/doFlush
      

Raw HTTP request syntax:

POST /pools/default/buckets/default/controller/doFlush
Host: localhost:8091
Authorization: Basic xxxxxxxxxxxxxxxxxxx
      

Example

Curl request example:


curl -X POST 'http://admin:password@localhost:8091/pools/default/buckets/default/controller/doFlush'
  

Raw HTTP request example:

POST /pools/default/buckets/default/controller/doFlush
Host: 10.5.2.54:8091
Authorization: Basic xxxxxxxxxxxxxxxxxxx
      

Response codes

If the flush is successful, the HTTP response code is 200 is returned.

HTTP/1.1 200 OK

If flushing is disable for the specified bucket, a 400 response code is returned with the bucket status. For example:

{"_":"Flush is disabled for the bucket"}

If the bucket does not exist, a 404 response code is returned.

404 Not Found