2020-05-13 20:51:39 +08:00
|
|
|
[[indices-create-data-stream]]
|
|
|
|
=== Create data stream API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Create data stream</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
|
|
|
Creates a new data stream.
|
|
|
|
|
2020-05-28 19:11:15 +08:00
|
|
|
A data stream can only be created if the namespace it targets has a component
|
2020-06-09 19:45:25 +08:00
|
|
|
template that exists with a `data_stream` definition.
|
2020-05-28 19:11:15 +08:00
|
|
|
|
2020-05-13 20:51:39 +08:00
|
|
|
[source,console]
|
2020-05-28 19:11:15 +08:00
|
|
|
-----------------------------------
|
|
|
|
PUT _index_template/template
|
2020-05-13 20:51:39 +08:00
|
|
|
{
|
2020-05-28 19:11:15 +08:00
|
|
|
"index_patterns": ["my-data-stream*"],
|
|
|
|
"data_stream": {
|
|
|
|
"timestamp_field": "@timestamp"
|
|
|
|
}
|
2020-05-13 20:51:39 +08:00
|
|
|
}
|
2020-05-28 19:11:15 +08:00
|
|
|
-----------------------------------
|
|
|
|
// TEST
|
|
|
|
|
|
|
|
[source,console]
|
|
|
|
--------------------------------------------------
|
|
|
|
PUT _data_stream/my-data-stream
|
2020-05-13 20:51:39 +08:00
|
|
|
--------------------------------------------------
|
2020-05-28 19:11:15 +08:00
|
|
|
// TEST[continued]
|
2020-05-13 20:51:39 +08:00
|
|
|
|
|
|
|
////
|
|
|
|
[source,console]
|
|
|
|
-----------------------------------
|
|
|
|
DELETE /_data_stream/my-data-stream
|
2020-05-28 19:11:15 +08:00
|
|
|
DELETE /_index_template/template
|
2020-05-13 20:51:39 +08:00
|
|
|
-----------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
////
|
|
|
|
|
|
|
|
[[indices-create-data-stream-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
|
|
|
`PUT _data_stream/<data-stream>`
|
|
|
|
|
|
|
|
[[indices-create-data-stream-desc]]
|
|
|
|
==== {api-description-title}
|
|
|
|
You can use the create data stream API to add a new data stream to an {es}
|
|
|
|
cluster. When creating a data stream, you must specify the following:
|
|
|
|
|
|
|
|
* The name of the data stream
|
|
|
|
* The name of the timestamp field.
|
|
|
|
|
|
|
|
[[indices-create-data-stream-api-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
|
|
|
`<data-stream>`::
|
|
|
|
+
|
|
|
|
--
|
|
|
|
(Required, string) Name of the data stream to create.
|
|
|
|
|
|
|
|
Data stream names must meet the following criteria:
|
|
|
|
|
|
|
|
- Lowercase only
|
|
|
|
- Cannot include `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, ` ` (space character),
|
|
|
|
`,`, `#`, `:`
|
|
|
|
- Cannot start with `-`, `_`, `+`, `.`
|
|
|
|
- Cannot be `.` or `..`
|
|
|
|
- Cannot be longer than 255 bytes (note it is bytes, so multi-byte characters
|
|
|
|
will count towards the 255 limit faster)
|
|
|
|
--
|
|
|
|
|