Roll over to a new index Added in 5.0.0
Creates a new index for a data stream or index alias.
Path parameters
-
Name of the data stream or index alias to roll over.
-
Name of the index to create. Supports date math. Data streams do not support this parameter.
Query parameters
-
dry_run boolean
If
true
, checks whether the current index satisfies the specified conditions but does not perform a rollover. -
master_timeout string
Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
-
timeout string
Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
-
wait_for_active_shards number | string
The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (
number_of_replicas+1
).
Body
-
aliases object
Aliases for the target index. Data streams do not support this parameter.
-
conditions object
Additional properties are allowed.
-
mappings object
Additional properties are allowed.
-
settings object
Configuration options for the index. Data streams do not support this parameter.
curl \
-X POST http://api.example.com/{alias}/_rollover/{new_index} \
-H "Content-Type: application/json" \
-d '"{\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n }\n}"'
{
"conditions": {
"max_age": "7d",
"max_docs": 1000,
"max_primary_shard_size": "50gb",
"max_primary_shard_docs": "2000"
}
}
{
"acknowledged": true,
"shards_acknowledged": true,
"old_index": ".ds-my-data-stream-2099.05.06-000001",
"new_index": ".ds-my-data-stream-2099.05.07-000002",
"rolled_over": true,
"dry_run": false,
"lazy": false,
"conditions": {
"[max_age: 7d]": false,
"[max_docs: 1000]": true,
"[max_primary_shard_size: 50gb]": false,
"[max_primary_shard_docs: 2000]": false
}
}