diff --git a/docs/reference/data-streams/data-stream-apis.asciidoc b/docs/reference/data-streams/data-stream-apis.asciidoc index 04a5a281c222c..b18965162670c 100644 --- a/docs/reference/data-streams/data-stream-apis.asciidoc +++ b/docs/reference/data-streams/data-stream-apis.asciidoc @@ -7,6 +7,7 @@ The following APIs are available for managing <>: * <> * <> * <> +* <> * <> For concepts and tutorials, see <>. @@ -17,4 +18,6 @@ include::{es-repo-dir}/indices/delete-data-stream.asciidoc[] include::{es-repo-dir}/indices/get-data-stream.asciidoc[] -include::{es-repo-dir}/indices/data-stream-stats.asciidoc[] \ No newline at end of file +include::{es-repo-dir}/indices/migrate-to-data-stream.asciidoc[] + +include::{es-repo-dir}/indices/data-stream-stats.asciidoc[] diff --git a/docs/reference/indices/migrate-to-data-stream.asciidoc b/docs/reference/indices/migrate-to-data-stream.asciidoc new file mode 100644 index 0000000000000..eee925c1d44d4 --- /dev/null +++ b/docs/reference/indices/migrate-to-data-stream.asciidoc @@ -0,0 +1,93 @@ +[role="xpack"] +[[indices-migrate-to-data-stream]] +=== Migrate to data stream API +++++ +Migrate to data stream +++++ + +Converts an <> to a <>. + +Data streams require a matching <>. +See <>. + +//// +[source,console] +---- +POST idx1/_doc/ +{ + "message" : "testing", + "@timestamp" : "2020-01-01" +} + +POST idx2/_doc/ +{ + "message" : "testing2", + "@timestamp" : "2020-01-01" +} + +POST /_aliases +{ + "actions": [ + { + "add": { + "index": "idx1", + "alias": "my-logs", + "is_write_index": true + } + }, + { + "add": { + "index": "idx2", + "alias": "my-logs" + } + } + ] +} + +PUT /_index_template/template +{ + "index_patterns": ["my-logs*"], + "data_stream": { } +} +---- +//// + +[source,console] +---- +POST /_data_stream/_migrate/my-logs +---- +// TEST[continued] + +//// +[source,console] +----------------------------------- +DELETE /_data_stream/my-logs +DELETE /_index_template/template +----------------------------------- +// TEST[continued] +//// + +[[indices-migrate-to-data-stream-request]] +==== {api-request-title} + +`POST /_data_stream/_migrate/` + +[[indices-migrate-to-data-stream-api-path-params]] +==== {api-path-parms-title} + +``:: ++ +-- +(Required, string) +Name of the index alias to convert to a data stream. The alias must meet the +following criteria: + +- The alias must have a <>. +- All indices for the alias have a `@timestamp` field mapping of a `date` or `date_nanos` field type. +- The alias must not have any <>. +- The alias must not use <>. + +If successful, the request removes the alias and creates a data stream with the +same name. The alias's indices become hidden backing indices for the stream. The +alias's write index becomes the stream's write index. +--