Roll over a collection #
Allocate a new rolling for the collection now, regardless of whether the active rolling is full — subsequent writes go to the new rolling. This is the manual form of the automatic rollover that happens when a rolling reaches its document capacity.
The change is replicated through Raft (the same metadata request used by automatic rollovers), so the shard groups of the new rolling are created on every node.
Examples #
The following request rolls the collection my-collection over to a new
rolling with the collection’s default rolling settings:
POST /my-collection/_rolling
The API returns the following result:
{
"acknowledged": true,
"collection": "default:my-collection",
"rolling_id": 1,
"rolling_uuid": "5f0c...",
"shard_groups": ["04ffe003da1e4fcab235", "..."]
}
A new rolling with a different shard count (and replica count) than the collection default:
POST /my-collection/_rolling
{
"settings": {
"rolling": {
"partitions_sharding_strategy": { "hash": { "number_of_shards": 4 } },
"number_of_replicas": 1
}
}
}
Request #
POST /[<namespace>:]<name>/_rolling
Path Parameters #
<namespace>
(Optional, string) The namespace which the collection belongs to.<name>
(Required, string) Name of the collection to roll over.
Request body #
Everything is optional — omitted values fall back to the collection’s
defaults (settings.rolling.* of PUT /<target>, changeable via
Update collection settings).
settings.rolling.partitions_sharding_strategy
(Optional, object) Sharding strategy of the new rolling, same format as at collection creation.settings.rolling.number_of_replicas
(Optional, integer) Replica count of the new rolling’s shard groups.
Response #
rolling_id— the sequence number of the new rolling.rolling_uuid— its UUID.shard_groups— the UUIDs of the created shard groups.