A newer version of this documentation is available.

View Latest

Flushing Buckets

    +
    The doFlush operation empties the contents of the specified bucket, deleting all stored data.

    Syntax

    The syntax is as follows:

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

    Raw HTTP request syntax:

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

    Description

    The doFlush operation succeeds only if flush was configured either during the initial creation of the bucket or after the settings have been changed.

    It is recommended that the flush capability is not used in production systems as it irreversibly deletes every document in the bucket. Even for use cases where this is the desired behaviour, flushing is not recommended as it is a very disruptive process. You can control and limit the ability to flush individual buckets by setting the flushEnabled parameter on a bucket in the Couchbase Web Console.

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

    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.
    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/[bucket_name]/controller/doFlush

    Example

    This is an example of flushing the default bucket:

    curl -X POST 'http://Administrator: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 200 is returned.

    HTTP/1.1 200 OK

    If flushing is disabled 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