**同步结果摘要**: | 目录 | 同步前 | 同步后 | 官方 | |------|--------|--------|------| | aggregations | 40 | 65 | 64 | | analyzers | 8 | 141 | 140 | | api-reference | 97 | 186 | 174 | | benchmark | 34 | 67 | 53 | | clients | 17 | 18 | 18 | | dashboards | 38 | 149 | 131 | | data-prepper | 77 | 134 | 123 | | im-plugin | 22 | 37 | 37 | | ingest-pipelines | 27 | 52 | 51 | | install-and-configure | 37 | 57 | 53 | | ml-commons-plugin | 81 | 157 | 155 | | observing-your-data | 39 | 73 | 66 | | query-dsl | 40 | 77 | 75 | | search-plugins | 80 | 139 | 95 | | security-analytics | 22 | 47 | 46 | **说明**: - 本地文件数 > 官方:本地有一些官方已删除或重命名的文件 - 新增了约 **740 个英文文档文件** - 已有文件保持不变(未覆盖)
4.2 KiB
layout, title, parent, nav_order, redirect_from
| layout | title | parent | nav_order | redirect_from | |
|---|---|---|---|---|---|
| default | Modify data stream | Data stream APIs | 40 |
|
Modify Data Stream API
Introduced 3.8 {: .label .label-purple }
This is an experimental feature and is not recommended for use in a production environment. For updates on the progress of the feature or if you want to leave feedback, see the associated GitHub issue. {: .warning}
The Modify Data Stream API adds or removes backing indexes of a data stream. Use this API to migrate a pre-existing regular index into a data stream or to detach a backing index without deleting its data.
The following behaviors and restrictions apply when you add or remove backing indexes:
- Add and remove actions change only the data stream metadata; the index and its data remain unchanged. No shards are created, deleted, restored, or relocated.
- You can include multiple add and remove actions in a request. All actions are applied atomically in a single cluster state update, and the result is independent of the action order.
- The data stream generation is derived from its backing indexes (the highest backing-index counter is the write index) and cannot be set directly.
- The write index cannot be removed, and removing the last backing index is rejected.
- An added index must map the data stream's timestamp field as a
dateordate_nanos. An added index is marked as hidden; a removed index is made visible again. - An added index need not follow the
.ds-<data_stream>-NNNNNNnaming convention, which allows you to migrate a pre-existing regular index into a data stream. - An index cannot be a backing index of more than one data stream.
Endpoints
POST /_data_stream/_modify
Query parameters
The following table lists the available query parameters. All query parameters are optional.
| Parameter | Data type | Description |
|---|---|---|
cluster_manager_timeout |
Time | The amount of time to wait for a response from the cluster manager node. Default is 30s. |
timeout |
Time | The amount of time to wait for a response from the cluster. Default is 30s. |
Request body fields
The following table lists the available request body fields.
| Field | Data type | Description |
|---|---|---|
actions |
Array | A list of actions to perform. You must provide at least one action. Required. |
Each element in the actions array is a single-key object that specifies one action. The following table lists the available action fields.
| Field | Data type | Description |
|---|---|---|
add_backing_index.data_stream |
String | The name of the data stream to modify. Required. |
add_backing_index.index |
String | The name of the index to add as a backing index. Required. |
remove_backing_index.data_stream |
String | The name of the data stream to modify. Required. |
remove_backing_index.index |
String | The name of the backing index to remove. Required. |
add_backing_index |
Object | Adds an existing index to the data stream as a backing index. Optional. |
remove_backing_index |
Object | Removes a backing index from the data stream. Optional. |
Example request
The following request removes a backing index from the logs-foo data stream and adds the pre-existing legacy-logs-2023 index to it in a single atomic operation:
POST /_data_stream/_modify
{
"actions": [
{
"remove_backing_index": {
"data_stream": "logs-foo",
"index": ".ds-logs-foo-000001"
}
},
{
"add_backing_index": {
"data_stream": "logs-foo",
"index": "legacy-logs-2023"
}
}
]
}
{% include copy-curl.html %}
Example response
{
"acknowledged": true
}
Required permissions
If you use the Security plugin, make sure you have the appropriate permissions: indices:admin/data_stream/modify.