Skip to content

Commit 7ccc57b

Browse files
committed
Fix serverless applicability in setting up data streams docs
Fixes #3384 and updates the page so that it can be used for both Stack and Serverless scopes.
1 parent 38f9f76 commit 7ccc57b

File tree

1 file changed

+55
-5
lines changed

1 file changed

+55
-5
lines changed

manage-data/data-store/data-streams/set-up-data-stream.md

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ products:
1212

1313
To set up a data stream, follow these steps:
1414

15-
1. [Create an index lifecycle policy](#create-index-lifecycle-policy)
15+
1. [Create an index lifecycle policy](#create-index-lifecycle-policy) {applies_to}`serverless: unavailable`
1616
2. [Create component templates](#create-component-templates)
1717
3. [Create an index template](#create-index-template)
1818
4. [Create the data stream](#create-data-stream)
@@ -30,8 +30,11 @@ For {{fleet}} and {{agent}}, refer to [](/reference/fleet/data-streams.md). For
3030

3131

3232
## Create an index lifecycle policy [create-index-lifecycle-policy]
33+
```{applies_to}
34+
serverless: unavailable
35+
```
3336

34-
While optional, we recommend using {{ilm-init}} to automate the management of your data stream’s backing indices. {{ilm-init}} requires an index lifecycle policy.
37+
While optional, we recommend using the index lifecycle management ({{ilm-init}}) capability to automate the management of your data stream’s backing indices. {{ilm-init}} requires an index lifecycle policy.
3538

3639
To create an index lifecycle policy in {{kib}}:
3740

@@ -90,6 +93,9 @@ PUT _ilm/policy/my-lifecycle-policy
9093
}
9194
```
9295

96+
:::{admonition} Simpler lifecycle management in {{serverless-short}} projects
97+
{{ilm-init}} lets you automatically transition indices through data tiers according to your performance needs and retention requirements. This allows you to balance hardware costs with performance. {{ilm-init}} is not available in {{serverless-short}} because in that environment your cluster performance is optimized for you. Instead, [data stream lifecycle](/manage-data/lifecycle/data-stream.md) is available as a data management option.
98+
:::
9399

94100
## Create component templates [create-component-templates]
95101

@@ -112,10 +118,15 @@ To create a component template in {{kib}}:
112118
1. Go to the **Index Management** page using the navigation menu or the [global search field](/explore-analyze/find-and-organize/find-apps-and-objects.md).
113119
1. In the **Index Templates** tab, click **Create component template**.
114120

115-
You can also use the [create component template API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-put-component-template).
121+
You can also use the [create component template](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-put-component-template) API for {{stack}} or the [create or update a component template](https://www.elastic.co/docs/api/doc/elasticsearch-serverless/operation/operation-cluster-put-component-template) API for {{serverless-full}}.
122+
123+
::::{tab-set}
124+
125+
:::{tab-item} {{stack}}
126+
:sync: stack
127+
To create a component template for mappings, use this query:
116128

117129
```console
118-
# Creates a component template for mappings
119130
PUT _component_template/my-mappings
120131
{
121132
"template": {
@@ -136,8 +147,11 @@ PUT _component_template/my-mappings
136147
"my-custom-meta-field": "More arbitrary metadata"
137148
}
138149
}
150+
```
139151

140-
# Creates a component template for index settings
152+
To create a component template for index settings, use this query:
153+
154+
```console
141155
PUT _component_template/my-settings
142156
{
143157
"template": {
@@ -152,6 +166,39 @@ PUT _component_template/my-settings
152166
}
153167
```
154168

169+
:::
170+
171+
:::{tab-item} {{serverless-short}}
172+
:sync: serverless
173+
To create a component template, use this query:
174+
175+
```console
176+
PUT _component_template/template_1
177+
{
178+
"template": {
179+
"settings": {
180+
"number_of_shards": 1
181+
},
182+
"mappings": {
183+
"_source": {
184+
"enabled": false
185+
},
186+
"properties": {
187+
"host_name": {
188+
"type": "keyword"
189+
},
190+
"created_at": {
191+
"type": "date",
192+
"format": "EEE MMM dd HH:mm:ss Z yyyy"
193+
}
194+
}
195+
}
196+
}
197+
}
198+
```
199+
200+
:::
201+
::::
155202

156203
## Create an index template [create-index-template]
157204

@@ -220,6 +267,9 @@ For an example, see [Data stream privileges](../../../deploy-manage/users-roles/
220267

221268

222269
## Convert an index alias to a data stream [convert-index-alias-to-data-stream]
270+
```{applies_to}
271+
serverless: unavailable
272+
```
223273

224274
Prior to {{es}} 7.9, you’d typically use an [index alias with a write index](../../lifecycle/index-lifecycle-management/tutorial-time-series-without-data-streams.md) to manage time series data. Data streams replace this functionality, require less maintenance, and automatically integrate with [data tiers](../../lifecycle/data-tiers.md).
225275

0 commit comments

Comments
 (0)