Update data stream lifecycles
Generally available; Added in 8.11.0
Update the data stream lifecycle of the specified data streams.
Path parameters
-
Comma-separated list of data streams used to limit the request. Supports wildcards (
*
). To target all data streams use*
or_all
.
Query parameters
-
Type of data stream that wildcard patterns can match. Supports comma-separated values, such as
open,hidden
.Supported values include:
all
: Match any data stream or index, including hidden ones.open
: Match open, non-hidden indices. Also matches any non-hidden data stream.closed
: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.hidden
: Match hidden data streams and hidden indices. Must be combined withopen
,closed
, orboth
.none
: Wildcard expressions are not accepted.
Values are
all
,open
,closed
,hidden
, ornone
. -
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.
Values are
-1
or0
. -
Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
Values are
-1
or0
.
Body
-
If defined, every document added to this data stream will be stored at least for this time frame. Any time after this duration the document could be deleted. When empty, every document in this data stream will be stored indefinitely.
-
The downsampling configuration to execute for the managed backing index after rollover.
-
If defined, it turns data stream lifecycle on/off (
true
/false
) for this data stream. A data stream lifecycle that's disabled (enabled:false
) will have no effect on the data stream.Default value is
true
.
PUT _data_stream/my-data-stream/_lifecycle
{
"data_retention": "7d"
}
resp = client.indices.put_data_lifecycle(
name="my-data-stream",
data_retention="7d",
)
const response = await client.indices.putDataLifecycle({
name: "my-data-stream",
data_retention: "7d",
});
response = client.indices.put_data_lifecycle(
name: "my-data-stream",
body: {
"data_retention": "7d"
}
)
$resp = $client->indices()->putDataLifecycle([
"name" => "my-data-stream",
"body" => [
"data_retention" => "7d",
],
]);
curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"data_retention":"7d"}' "$ELASTICSEARCH_URL/_data_stream/my-data-stream/_lifecycle"
client.indices().putDataLifecycle(p -> p
.dataRetention(d -> d
.time("7d")
)
.name("my-data-stream")
);
{
"data_retention": "7d"
}
{
"downsampling": [
{
"after": "1d",
"fixed_interval": "10m"
},
{
"after": "7d",
"fixed_interval": "1d"
}
]
}
{
"acknowledged": true
}