Update data streams Generally available; Added in 7.16.0

POST /_data_stream/_modify

Performs one or more data stream modification actions in a single atomic operation.

application/json

Body Required

  • actions array[object] Required

    Actions to perform.

    Hide actions attributes Show actions attributes object
    • add_backing_index object

      Adds an existing index as a backing index for a data stream. The index is hidden as part of this operation. WARNING: Adding indices with the add_backing_index action can potentially result in improper data stream behavior. This should be considered an expert level API.

      Hide add_backing_index attributes Show add_backing_index attributes object
      • data_stream string Required

        Data stream targeted by the action.

      • index string Required

        Index for the action.

    • remove_backing_index object

      Removes a backing index from a data stream. The index is unhidden as part of this operation. A data stream’s write index cannot be removed.

      Hide remove_backing_index attributes Show remove_backing_index attributes object
      • data_stream string Required

        Data stream targeted by the action.

      • index string Required

        Index for the action.

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • acknowledged boolean Required

      For a successful response, this value is always true. On failure, an exception is returned instead.

POST /_data_stream/_modify
POST _data_stream/_modify { "actions": [ { "remove_backing_index": { "data_stream": "my-data-stream", "index": ".ds-my-data-stream-2023.07.26-000001" } }, { "add_backing_index": { "data_stream": "my-data-stream", "index": ".ds-my-data-stream-2023.07.26-000001-downsample" } } ] }
resp = client.indices.modify_data_stream( actions=[ { "remove_backing_index": { "data_stream": "my-data-stream", "index": ".ds-my-data-stream-2023.07.26-000001" } }, { "add_backing_index": { "data_stream": "my-data-stream", "index": ".ds-my-data-stream-2023.07.26-000001-downsample" } } ], )
const response = await client.indices.modifyDataStream({ actions: [ { remove_backing_index: { data_stream: "my-data-stream", index: ".ds-my-data-stream-2023.07.26-000001", }, }, { add_backing_index: { data_stream: "my-data-stream", index: ".ds-my-data-stream-2023.07.26-000001-downsample", }, }, ], });
response = client.indices.modify_data_stream( body: { "actions": [ { "remove_backing_index": { "data_stream": "my-data-stream", "index": ".ds-my-data-stream-2023.07.26-000001" } }, { "add_backing_index": { "data_stream": "my-data-stream", "index": ".ds-my-data-stream-2023.07.26-000001-downsample" } } ] } )
$resp = $client->indices()->modifyDataStream([ "body" => [ "actions" => array( [ "remove_backing_index" => [ "data_stream" => "my-data-stream", "index" => ".ds-my-data-stream-2023.07.26-000001", ], ], [ "add_backing_index" => [ "data_stream" => "my-data-stream", "index" => ".ds-my-data-stream-2023.07.26-000001-downsample", ], ], ), ], ]);
curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"actions":[{"remove_backing_index":{"data_stream":"my-data-stream","index":".ds-my-data-stream-2023.07.26-000001"}},{"add_backing_index":{"data_stream":"my-data-stream","index":".ds-my-data-stream-2023.07.26-000001-downsample"}}]}' "$ELASTICSEARCH_URL/_data_stream/_modify"
client.indices().modifyDataStream(m -> m .actions(List.of(Action.of(a -> a .removeBackingIndex(r -> r .dataStream("my-data-stream") .index(".ds-my-data-stream-2023.07.26-000001") )),Action.of(ac -> ac .addBackingIndex(ad -> ad .dataStream("my-data-stream") .index(".ds-my-data-stream-2023.07.26-000001-downsample") )))) ); 
Request example
An example body for a `POST _data_stream/_modify` request.
{ "actions": [ { "remove_backing_index": { "data_stream": "my-data-stream", "index": ".ds-my-data-stream-2023.07.26-000001" } }, { "add_backing_index": { "data_stream": "my-data-stream", "index": ".ds-my-data-stream-2023.07.26-000001-downsample" } } ] }