Flushing Buckets

  • reference
    +
    Flushing a bucket, which deletes all data stored within the bucket, can be performed with the REST API.

    HTTP method and URI

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

    Description

    Flushing a bucket deletes all data currently stored in the bucket. This operation can only be performed if the bucket has been configured with flushing enabled. Enablement is performed either when the bucket is created, or subsequently, by editing. For information, see Creating and Editing Buckets.

    A bucket cannot be flushed if it is currently the source for an outgoing XDCR replication. For information on XDCR, see Cross Data Center Replication (XDCR).

    Note that if the bucket contains a large number of documents, flushing causes a correspondingly high disk utilization.

    Curl Syntax

    curl -X POST -u <username>:<password>
      <ip-address-or-domain-name>:8091/pools/default/buckets/<bucket-name>/controller/doFlush

    The bucket-name is the name of the bucket that is to be flushed.

    If flushing is disabled for the specified bucket, 400 Bad Request is returned, with the following error message: {"_":"Flush is disabled for the bucket"}. If the URI is incorrectly specified, the operation fails with 404 Object Not Found. Failure to authenticate returns 401 Unauthorized.

    If flushing is attempted on a bucket that is the source for an ongoing XDCR replication, the operation fails with 503 Service Unavailable, and the following error message: {"_":"Cannot flush buckets with outgoing XDCR"}.

    Example

    The following example flushes the bucket beer-sample. The example assumes that flushing has already been enabled on the bucket.

    curl -v -X POST \
    http://10.144.220.101:8091/pools/default/buckets/beer-sample/controller/doFlush \
    -u Administrator:password

    See Also

    For information on enabling flushing with the REST API, see Creating and Editing Buckets. Further options for enabling and flushing a bucket, with the UI or CLI, are described in Flush a Bucket. An overview of buckets is provided in Buckets.

    For information on XDCR, see Cross Data Center Replication (XDCR).