A newer version of this documentation is available.

View Latest

Creating and Editing Buckets

  • reference
    +
    Buckets can be created, and their configurations subsequently edited, with the REST API.

    HTTP Methods and URIs

    POST /pools/default/buckets
    
    POST /pools/default/buckets/<bucketName>

    Description

    These respectively create a new bucket and edit an existing bucket. The bucket can be of any type: Couchbase, Ephemeral, or Memcached. (Note, however that Memcached buckets are now deprecated.)

    On creation, a bucket must be assigned a name that is unique among buckets defined on the cluster: this name cannot subsequently be changed. Names cannot be longer than 100 bytes (which is to say, characters).

    A maximum of 30 buckets can be created on a single cluster.

    Administrators with either the Full Admin or the Cluster Admin role can create buckets and edit their configurations. Bucket configurations can also be edited by administrators with the Bucket Admin role, provided that its privileges have been extended either to all buckets on the cluster, or to the specific bucket whose configuration is to be edited. See Roles, for information on roles and privileges.

    Curl Syntax

    Note that floats and integers referred to in the following syntax-display are non-negative only.

    curl -X POST -u <administrator>:<password>
      http://<ip-address-or-hostname>:<port>/pools/default/buckets
      -d name=<bucketName>
      -d bucketType=[ couchbase | ephemeral | memcached ]
      -d ramQuotaMB=<integer>
      -d evictionPolicy=[
              [ valueOnly | fullEviction ] |
              [ noEviction | nruEviction ]
            ]
      -d durabilityMinLevel=[
              [ none | majority | majorityAndPersistActive | persistToMajority ] |
              [ none | majority ]
            ]
      -d threadsNumber=[ 3 | 8 ]
      -d replicaNumber=[ 1 | 2 | 3 ]
      -d compressionMode=[ off | passive | active ]
      -d maxTTL=<integer>
      -d replicaIndex=[ 0 | 1 ]
      -d conflictResolutionType=[ seqno | lww ]
      -d flushEnabled=[ 0 | 1 ]
      -d autoCompactionDefined=[ true | false ]
        -d parallelDBAndViewCompaction=[ true | false ]
        -d databaseFragmentationThreshold[percentage]=<integer>
        -d databaseFragmentationThreshold[size]=<integer>
        -d viewFragmentationThreshold[percentage]=<integer>
        -d viewFragmentationThreshold[size]=<integer>
        -d purgeInterval=[ <float> | <integer> ]
        -d allowedTimePeriod[fromHour]=<integer>
        -d allowedTimePeriod[fromMinute]=<integer>
        -d allowedTimePeriod[toHour]=<integer>
        -d allowedTimePeriod[toMinute]=<integer>
        -d allowedTimePeriod[abortOutside]=[ true | false ]

    All parameters are described in the following subsections.

    Parameter Groups

    Parameters that support the creation and editing of buckets can be considered to form two groups; which are, respectively, General and Auto-compaction.

    General

    Parameters in the General group support both standard and memory-optimized storage, and apply equally to Couchbase Server Enterprise and Community Editions. They include:

    For full details and examples, see General Parameters, below.

    Auto-Compaction

    Parameters in the Auto-compaction group support only standard storage: they are unnecessary for memory-optimized storage, and so are ignored, if explicitly specified when memory-optimized storage has been configured. For information on index storage, see Storage Settings.

    All auto-compaction parameters can be edited, following bucket creation.

    Note that Auto-compaction parameters take effect only if both of the following are true:

    For full details and examples, see Auto-Compaction Parameters, below.

    General Parameters

    The parameters listed in the following subsections are all included in the General group, and therefore apply equally to Couchbase Server Enterprise and Community Editions.

    name

    A name for a bucket that is to be created. The name must be unique among the bucket-names defined for the cluster, and cannot be longer than 100 characters. Acceptable characters are A-Z, a-z, and 0-9. Additionally, the underscore, period, dash, and percent characters can be used.

    The name parameter must be specified, if a bucket is being created. If it is not, or if the intended name is improperly designed, an error-notification is returned. For example: : {"name":"Bucket name needs to be specified"}. Note that a bucket-name cannot be changed after bucket-creation. Therefore, if this parameter is specified in an attempt to edit the bucket-configuration, it is ignored. To edit the configuration of an existing bucket, the bucket-name must be specified as the <bucketName> path-parameter; as indicated above, in HTTP Methods and URIs.

    Example: Defining a New Name, When Creating

    In the following example, a bucket named testBucket is created, with a RAM-size of 256 megabytes. The bucket name is specified by means of the name parameter, with a value of testBucket.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256

    If successful, the call returns a 202 Accepted notification, with empty content.

    Example: Referencing the Existing Name, When Editing

    To edit the bucket, the same endpoint is used, but with the bucket name specified as a concluding path-parameter, as follows:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d ramQuotaMB=512

    The value of the ramQuotaMB parameter (described below), is hereby increased to 512 megebytes.

    bucketType

    Specifies the type of the bucket. This can be couchbase (which is the default), ephemeral, or memcached. For a detailed explanation of bucket types, see Buckets.

    If an invalid bucket type is specified, the error-notification {"bucketType":"invalid bucket type"} is returned.

    This parameter cannot be modified, following bucket-creation. If an attempt at modification is made, the parameter is ignored.

    Example: Defining a Bucket Type, When Creating

    A bucket type can only be specified when the bucket is created: the specified type cannot be changed subsequently.

    The following example creates a bucket, named testBucket, whose type is ephemeral:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256 \
    -d bucketType=ephemeral

    If successful, the call returns a 202 Accepted notification. No object is returned.

    ramQuotaMB

    The amount of memory to be allocated to the bucket, per node, in megabytes. The minimum amount is 100 MB. The maximum amount is the total Data Service memory quota configured per node, minus the amount already assigned to other buckets. For information on per node memory configuration, see the page for General Settings.

    A value for ramQuota must be specified: the value can be modified, following bucket-creation.

    An incorrect memory-specification returns a notification such as {"ramQuotaMB":"RAM quota cannot be less than 100 MB"}.

    Example: Specifying a Memory Quota, when Creating

    The following example creates a Couchbase bucket, named testBucket and assigns it 256 megabytes of memory.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256

    Note that the bucket is of type couchbase by default.

    If successful, the call returns a 202 Accepted notification. No object is returned.

    Example: Specifying a New Memory Quota, when Editing

    The following example assigns a new memory quota, of 512 megabytes, to the existing bucket testBucket.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d ramQuotaMB=512

    If successful, the call returns a 200 OK notification. No object is returned.

    evictionPolicy

    The ejection policy to be assigned to and used by the bucket. (Note that eviction is, in the current release, referred to as ejection; and this revised naming will continue to be used in future releases.) Policy-assignment depends on bucket type. For a Couchbase bucket, the policy can be valueOnly (which is the default) or fullEviction. For an Ephemeral bucket, the policy can be noEviction (which is the default) or nruEviction. No policy can be assigned to a Memcached bucket.

    This value can be modified, following bucket-creation. If such modification occurs, the bucket is restarted with the new setting: this may cause inaccessibility of data, during the bucket’s warm-up period.

    Incorrect specification of an ejection policy returns an error-notification, such as {"evictionPolicy":"Eviction policy must be either 'valueOnly' or 'fullEviction' for couchbase buckets"}.

    For information on ejection policies, see Bucket Types. For general information on memory management in the context of ejection, see Ejection.

    Example: Specifying an Eviction Policy, when Creating

    The following example creates a new bucket, named testBucket, which is a Couchbase bucket by default; and assigns it the fullEviction policy.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket -d ramQuotaMB=256 \
    -d evictionPolicy=fullEviction

    If successful, the call returns a 202 Accepted notification. No object is returned.

    Example: Specifying a New Eviction Policy, when Editing

    The following example modifies the eviction policy of the existing bucket testBucket, specifying that it should be valueOnly.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d evictionPolicy=valueOnly

    If successful, the call returns a 200 OK notification. No object is returned.

    durabilityMinLevel

    A durability level to be assigned to the bucket, as the minimum level at which all writes to the bucket must occur. Level-assignment depends on bucket type. For a Couchbase bucket, the level can be none, majority, majorityAndPersistActive, or persistToMajority. For an Ephemeral bucket, the level can be none or majority. No level can be assigned to a Memcached bucket.

    This parameter can be modified, following bucket-creation.

    For information on durability and levels, see Durability.

    Example: Specifying a Minimum Durability Level, when Creating

    The following example creates a new bucket, named testBucket, which is a Couchbase bucket by default; and assigns it the minimum durability level of majorityAndPersistActive.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256 \
    -d durabilityMinLevel=majorityAndPersistActive

    If successful, the call returns a 202 Accepted notification. No object is returned.

    Example: Specifying a New Minimum Durability Level, when Editing

    The following example modifies the minimum durability level of the existing bucket testBucket, changing the level to persistToMajority.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d durabilityMinLevel=persistToMajority

    If successful, the call returns a 200 OK notification. No object is returned.

    threadsNumber

    The priority for the bucket, as described in Create a Bucket. Priority can be established as either Low or High. To establish priority as Low (which is the default), the value of threadsNumber must be 3. To establish priority as High, the value must be 8. If any other value is used, the value is ignored; and the bucket’s priority remains low.

    If this parameter is incorrectly specified, an error-notification such as the following is returned: {"threadsNumber":"The number of threads must be an integer between 2 and 8"}. (Note that, as indicated above, all values other than 3 and 8 are ignored.)

    This parameter can be modified, following bucket-creation. If such modification occurs, the bucket is restarted with the new setting: this may cause inaccessibility of data, during the bucket’s warm-up period.

    Example: Specifying a Bucket Priority, when Creating

    The following example creates a new bucket, named testBucket, which is a Couchbase bucket by default; and assigns it a High priority, by specifying 8 as the value to the threadsNumber parameter.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256 \
    -d threadsNumber=8

    If successful, the call returns a 202 Accepted notification. No object is returned.

    Example: Specifying a New Bucket Priority, when Editing

    The following example modifies the priority of the existing bucket testBucket, changing the level to Low, by establishing 3 as the value of the threadsNumber parameter.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d threadsNumber=3

    If successful, the call returns a 200 OK notification. No object is returned.

    replicaNumber

    The number of replicas for the bucket. For information on replicas and replication, see Intra-Cluster Replication and vBuckets. The possible values are 0 (which disables replication, and therefore ensures that no replicas will be maintained), 1 (which is the default), 2, and 3. If a number greater than 3 is specified, the following error-notification is returned: {"replicaNumber":"Replica number larger than 3 is not supported."}.

    If more replicas are requested than can be assigned to the cluster, due to an insufficient number of nodes, no notification is returned. Instead, the maximum possible number of replicas is created: additional replicas will be added subsequently, if more nodes become available.

    This parameter can be modified, following bucket-creation. Such modification may require a rebalance: for information, see Rebalance.

    Example: Specifying a Number of Replicas, when Creating

    The following example creates a new bucket, named testBucket, and specifies that it should have 3 replicas.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256 \
    -d replicaNumber=3

    If successful, the call returns a 202 Accepted notification. No object is returned.

    Example: Specifying a Modified Number of Replicas, when Editing

    The following example changes the replica-number of the existing bucket testBucket, specifying that the number be 2:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d replicaNumber=2

    If successful, the call returns a 200 OK notification. No object is returned.

    compressionMode

    The compression mode for the bucket. The possible values are off, passive (which is the default), and active. If the value is incorrectly specified, the following error-notification is returned: {"compressionMode":"compressionMode can be set to 'off', 'passive' or 'active'"}.

    This parameter can be modified, following bucket-creation.

    For information on compression and compression modes, see Compression.

    Example: Specifying a Compression Mode, when Creating

    The following example creates a new bucket, named testBucket, and assigns it the active compression mode:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256 \
    -d compressionMode=active

    If successful, the call returns a 202 Accepted notification. No object is returned.

    Example: Specifying a New Compression Mode, when Editing

    The following example changes the compression mode of the existing bucket testBucket, specifying that the mode now be off:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d compressionMode=off

    If successful, the call returns a 200 OK notification. No object is returned.

    maxTTL

    Sets the bucket’s maximum time to live. The default value is 0, which does not have documents automatically expire. It also does not affect expiration values you directly set on a document.

    Setting this parameter to a non-zero value has two effects:

    • It sets a default expiration time for documents you create or mutate in the bucket. The bucket’s maxTTL value can be overridden by a maxTTL parameter set on the collection containing a document, or by directly setting an expiration on the document itself (except as explained in the next point).

    • It sets the maximum time in seconds a document can exist before it expires. You can explicitly set a document to expire before this time. Attempting to set a document to expire after this time has Couchbase Server set the document to expire in maxTTL seconds. As with setting a default expiration, a non-zero maxTTL setting on a document’s collection overrides the bucket’s maxTTL setting.

    The maximum value is MAX32INT (2147483647 seconds, or 68.096 years). Attempting to set maxTTL value greater than MAX32INT returns an the error: {"maxTTL":"Max TTL must be an integer between 0 and 2147483647"}.

    You can modify this value after creating the bucket. Changing the maxTTL on the bucket only affects documents when you create or mutate them. Setting or changing the maxTTL does not cause existing documents to start expiring.

    For more information, see Expiration.

    Example: Specifying a Time-to-Live Value, when Creating

    The following example creates a new bucket, named testBucket, and assigns it a time-to-live of 500,000 seconds:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256 \
    -d maxTTL=500000

    If successful, the call returns a 202 Accepted notification. No object is returned.

    Example: Specifying a New Time-to-Live value, when Editing

    The following example modifies the time-to-live setting of the existing bucket testBucket, reducing it to 0, and thereby disabling expiration.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d maxTTL=0

    If successful, the call returns a 200 OK notification. No object is returned.

    replicaIndex

    Specifies whether View Indexes are to be replicated. The value can be either 0 (which is the default), specifying that they are not to be replicated; or 1, specifying that they are to be replicated. Specifying any other value returns an error-notification such as the following: {"replicaIndex":"replicaIndex can only be 1 or 0"}.

    This option is valid for Couchbase buckets only. Note that there may be, at most, one replica view index.

    This parameter cannot be modified, following bucket-creation.

    Example: Specifying View Index Replication, when Creating

    View index replication can only be specified when a bucket is created. Attempts to change the value subsequently are ignored.

    The following example creates a new bucket, named testBucket, and specifies that View indexes are to be replicated:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256 \
    -d replicaIndex=1

    If successful, the call returns a 202 Accepted notification. No object is returned.

    conflictResolutionType

    Specifies the conflict resolution type for the bucket. The value can be seqno (which is the default), specifying sequence-number based resolution; or lww (last write wins), specifying timestamp-based resolution This parameter cannot be modified, following bucket-creation. If modification is attempted, the following error-notification is returned: {"conflictResolutionType":"Conflict resolution type not allowed in update bucket"}.

    For information on conflict resolution, see: XDCR Conflict Resolution.

    Example: Specifying a Conflict Resolution Policy, when Creating

    A bucket’s conflict resolution policy can only be specified when the bucket is created: attempts to change the setting subsequently are ignored.

    The following example creates a new bucket, named testBucket, specifying the lww conflict resolution policy.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256 \
    -d conflictResolutionType=lww

    If successful, the call returns a 202 Accepted notification. No object is returned.

    flushEnabled

    Whether flushing is enabled for the bucket. The value can be either 1, which enables flushing; or 0, which is the default, and disables flushing.

    Flushing deletes every document in the bucket, and therefore should not be enabled unless absolutely necessary.

    This parameter can be modified, following bucket-creation.

    Example: Enable Flushing, when Creating

    The following example creates a new bucket, named testBucket, and enables flushing:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256 \
    -d flushEnabled=1

    If successful, the call returns a 202 Accepted notification. No object is returned.

    Example: Modify Flushing Enablement-Status, when Editing

    The following example modifies the flushing enablement-status of the existing bucket, testBucket, switching it to disabled, by specifying the value 0 for the parameter flushEnabled:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d flushEnabled=0

    If successful, the call returns a 200 OK notification. No object is returned.

    Auto-Compaction Parameters

    The parameters listed in the following subsections are all included in the Auto-compaction group

    autoCompactionDefined

    Specifies whether the default auto-compaction settings are to be modified for this bucket. The value specified can be either true or false (which is the default). If the value is false, any parameter-values specified in order to modify the default auto-compaction settings are ignored. If the value is incorrectly specified, an error-notification such as the following is returned: {"autoCompactionDefined":"autoCompactionDefined is invalid"}.

    Note that if autoCompactionDefined is specified as true:

    • All other auto-compaction-related parameters that need to be established should themselves be explicitly specified in the current call.

    • The parameter parallelDBAndViewCompaction must be defined. If it is not defined, an error-notification such as the following is returned: {"parallelDBAndViewCompaction":"parallelDBAndViewCompaction is missing"}.

    Auto-compaction settings are unnecessary for memory-optimized indexes. For information on index storage, see Storage Settings.

    For further information on auto-compaction settings, see Auto-Compaction.

    Example: Enabling Auto-Compaction, when Creating

    The following example creates a new bucket, named testBucket, and enables auto-compaction for the bucket. Necessarily, a setting is also explicitly made for parallelDBAndViewCompaction:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256 \
    -d autoCompactionDefined=true \
    -d parallelDBAndViewCompaction=false

    If successful, the call returns a 202 Accepted notification. No object is returned.

    Example: Modifying Auto-Compaction Enablement, when Editing

    The following example changes the auto-compaction enablement of the existing bucket testBucket, disabling auto-compaction, by specifying the value false to the autoCompactionDefined parameter:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d autoCompactionDefined=false

    This disables auto-compaction for the bucket, and removes all auto-compaction-related settings. If the call is successful, a 200 OK notification is returned, with no object.

    To enable auto-compaction after bucket creation, the parallelDBAndViewCompaction parameter must also be specified; as in the following example, which sets parallelDBAndViewCompaction to false:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d autoCompactionDefined=true \
    -d parallelDBAndViewCompaction=false

    If successful, the call returns a 200 OK notification. No object is returned.

    parallelDBAndViewCompaction

    Specifies whether compaction should occur to documents and view indexes in parallel. This is a global setting, which therefore affects all buckets on the cluster. The value can either be true or false: one value or the other must be specified. If the value is incorrectly specified, the following error-notification is returned: {"parallelDBAndViewCompaction":"parallelDBAndViewCompaction is invalid"}.

    This parameter-value is ignored if autoCompactionDefined is false (which is its default value).

    For examples, see autoCompactionDefined, above.

    databaseFragmentationThreshold[percentage]

    Specifies, as a percentage, the level of database fragmentation that must be reached for data compaction to be automatically triggered. The assigned value must be an integer from 0 to 100. The default value is "undefined".

    If a value for databaseFragmentationThreshold[size] is also specified, data compaction is automatically triggered as soon as the threshold specified by one parameter or the other is reached.

    If this parameter is incorrectly specified, an error-notification such as the following is returned: "databaseFragmentationThreshold[percentage]":"database fragmentation must be an integer".

    This parameter is ignored if autoCompactionDefined is false (which is its default value).

    Example: Specifying a Data Fragmentation Threshold as a Percentage, when Creating

    The following example establishes a value for databaseFragmentationThreshold[percentage], and for all other auto-compaction-related parameters, in its creation of a new bucket, named testBucket:

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets \
    -u Administrator:password \
    -d name=testBucket \
    -d ramQuotaMB=256 \
    -d autoCompactionDefined=true \
    -d parallelDBAndViewCompaction=false \
    -d databaseFragmentationThreshold[percentage]=30 \
    -d databaseFragmentationThreshold[size]=1073741824 \
    -d viewFragmentationThreshold[percentage]=30 \
    -d viewFragmentationThreshold[size]=1073741824 \
    -d allowedTimePeriod[fromHour]=0 \
    -d allowedTimePeriod[fromMinute]=0 \
    -d allowedTimePeriod[toHour]=6 \
    -d allowedTimePeriod[toMinute]=0 \
    -d allowedTimePeriod[abortOutside]=true \
    -d purgeInterval=3.0

    The data fragmentation threshold percentage is hereby specified as 30.

    If successful, the call returns a 202 Accepted notification. No object is returned.

    Example: Specifying a Data Fragmentation Threshold as a Percentage, when Editing

    The following example modifies the databaseFragmentationThreshold[percentage] setting for the existing bucket testBucket; establishing a new value of 47. Note that although other auto-compaction settings are intended to be unchanged from their previous, explicit settings, all must be respecified correspondingly in the new call: otherwise, all revert to their default values.

    curl -v -X POST http://10.143.201.101:8091/pools/default/buckets/testBucket \
    -u Administrator:password \
    -d autoCompactionDefined=true \
    -d parallelDBAndViewCompaction=false \
    -d databaseFragmentationThreshold[percentage]=47 \
    -d databaseFragmentationThreshold[size]=1073741824 \
    -d viewFragmentationThreshold[percentage]=30 \
    -d viewFragmentationThreshold[size]=1073741824 \
    -d allowedTimePeriod[fromHour]=0 \
    -d allowedTimePeriod[fromMinute]=0 \
    -d allowedTimePeriod[toHour]=6 \
    -d allowedTimePeriod[toMinute]=0 \
    -d allowedTimePeriod[abortOutside]=true \
    -d purgeInterval=3.0

    databaseFragmentationThreshold[size]

    Specifies, as a size in megabytes, the level of database fragmentation that must be reached for data compaction to be automatically triggered. The assigned value must be a positive integer. The default value is "undefined".

    If a value for databaseFragmentationThreshold[percentage] is also specified, data compaction is automatically triggered as soon as the threshold specified by one parameter or the other is reached.

    If this parameter is incorrectly specified, an error-notification such as the following is returned: "databaseFragmentationThreshold[size]":"database fragmentation must be an integer".

    This parameter is ignored if autoCompactionDefined is false (which is its default value).

    viewFragmentationThreshold[percentage]

    Specifies, as a percentage, the level of View fragmentation that must be reached for View compaction to be automatically triggered. The assigned value must be an integer from 0 to 100. The default value is "undefined".

    If a value for viewFragmentationThreshold[size] is also specified, View compaction is automatically triggered as soon as the threshold specified by one parameter or the other is reached.

    If this parameter is incorrectly specified, an error-notification such as the following is returned: "viewFragmentationThreshold[percentage]":"view fragmentation must be an integer".

    This parameter is ignored if autoCompactionDefined is false (which is its default value).

    viewFragmentationThreshold[size]

    Specifies, as a size in megabytes, the level of View fragmentation that must be reached for View compaction to be automatically triggered. The assigned value must be a positive integer. The default value is "undefined".

    If a value for viewFragmentationThreshold[percentage] is also specified, View compaction is automatically triggered as soon as the threshold specified by one parameter or the other is reached.

    If this parameter is incorrectly specified, an error-notification such as the following is returned: "viewFragmentationThreshold[size]":"view fragmentation size must be an integer".

    This parameter is ignored if autoCompactionDefined is false (which is its default value).

    purgeInterval

    Specifies the tombstone (or metadata) purge interval. The value can be either an integer (indicating a number of days), or a float (indicating an interval that may be greater or less than one day, and entails a number of hours, with 0.04 indicating one hour). The default value is three days.

    If this parameter is incorrectly specified, an error-notification such as the following is returned: {"purgeInterval":"metadata purge interval must be a number"}.

    For more information see Tombstone Purge Interval and Storage.

    This parameter is ignored if autoCompactionDefined is false (which is its default value).

    allowedTimePeriod[fromHour]

    The starting hour of the time-period during which auto-compaction is permitted to run. The value must be an integer. The default value is 0. If the value is incorrectly specified, an error-notification such as either of the following is returned: {"allowedTimePeriod[fromHour]":"from hour must be an integer"} , {"allowedTimePeriod[fromHour]":"from hour is too large. Allowed range is 0 - 59"}..

    This parameter is ignored if autoCompactionDefined is false (which is its default value).

    allowedTimePeriod[fromMinute]

    The starting minute of the time-period during which auto-compaction is permitted to run. The value must be an integer. The default value is 0. If the value is incorrectly specified, an error-notification such as either of the following is returned: {"allowedTimePeriod[fromMinute]":"from minute must be an integer"}, {"allowedTimePeriod[fromMinute]":"from minute is too large. Allowed range is 0 - 59"}.

    This parameter is ignored if autoCompactionDefined is false (which is its default value).

    allowedTimePeriod[toHour]

    The ending hour of the time-period during which auto-compaction is permitted to run. The value must be an integer. The default value is 0. If the value is incorrectly specified, an error-notification such as either of the following is returned: {"allowedTimePeriod[fromHour]":"to hour must be an integer"}, {"allowedTimePeriod[toHour]":"to hour is too large. Allowed range is 0 - 59"}.

    This parameter is ignored if autoCompactionDefined is false (which is its default value).

    allowedTimePeriod[toMinute]

    The ending minute of the time-period during which auto-compaction is permitted to run. The value must be an integer. The default value is 0. If the value is incorrectly specified, an error-notification such as either of the following is returned: {"allowedTimePeriod[toMinute]":"to minute must be an integer"}, {"allowedTimePeriod[toMinute]":"to minute is too large. Allowed range is 0 - 59"}.

    allowedTimePeriod[abortOutside]

    Specifies whether compaction can be aborted if the specified time-period is exceeded. The value must be either true or false (which is the default).

    This parameter is ignored if autoCompactionDefined is false (which is its default value).

    Responses

    If bucket-creation is successful, HTTP response 202 Accepted is returned, with empty content. If bucket-editing is successful, HTTP response 200 OK is returned, with empty content. If the bucket cannot created due to a missing or incorrect parameter, a 400 response is returned, with a JSON payload containing the reason for the error (errors are described per parameter, in the sections above).

    If the URL is incorrectly specified a 404 (Object Not Found) error is returned. Failure to authenticate gives 401 Unauthorized.

    See Also

    A conceptual description of buckets is provided in Buckets. Options for managing buckets with Couchbase Web Console are provided in Manage Buckets. For information on the Couchbase CLI command bucket-create, see the reference page for bucket-create.

    Information on memory-management options for Couchbase Server is provided in For information on index storage, see Storage Settings. Information on auto-compaction settings is provided in Auto-Compaction.

    Information on other, Couchbase-Server key concepts can be found as follows: for durability, in Durability; for expiration (time-to-live), in Expiration; for ejection, in Memory; for replication, in Intra-Cluster Replication; for compression, in Compression; for conflict resolution, in XDCR Conflict Resolution; for purging, in Tombstone Purge Interval.

    See Roles, for information on roles and privileges.

    For information on how to inspect a bucket’s current configuration, see Getting All Bucket Information.