Skip to content

Commit 42bca5b

Browse files
occidereAdam Locke
andauthored
[DOCS] Relocate scriptless runtime document (#68916)
* Reallocate runtime document Reallocate document `runtime-fields-scriptless` from `runtime-search-request` to `runtime-mapping-fields` * Move runtime without script section Move runtime without script section to under the dynamic runtime mapping section * Fix snippet formatting and remove discrete heading. * Update test snippet. Co-authored-by: Adam Locke <[email protected]>
1 parent 1195b20 commit 42bca5b

File tree

1 file changed

+39
-35
lines changed

1 file changed

+39
-35
lines changed

docs/reference/mapping/runtime.asciidoc

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -139,22 +139,48 @@ PUT my-index
139139
}
140140
----
141141

142-
You can update or remove runtime fields at any time. To replace an existing runtime field, add a new runtime field to the mappings with the same name. To remove a runtime field from the mappings, set the value of the runtime field to `null`:
143-
144-
[source,console]
145-
----
146-
PUT my-index/_mapping
147-
{
148-
"runtime": {
149-
"day_of_week": null
150-
}
151-
}
152-
----
142+
[[runtime-fields-scriptless]]
143+
==== Define runtime fields without a script
144+
You can define a runtime field in the mapping definition without a
145+
script. At query time, {es} looks in `_source` for a field with the same name
146+
and returns a value if one exists. If a field with the same name doesn’t
147+
exist, the response doesn't include any values for that runtime field.
148+
149+
[source,console]
150+
----
151+
PUT my-index/
152+
{
153+
"mappings": {
154+
"runtime": {
155+
"day_of_week": {
156+
"type": "keyword"
157+
}
158+
}
159+
}
160+
}
161+
----
153162

154163
[[runtime-updating-scripts]]
155-
.Updating and removing runtime fields
156-
****
164+
==== Updating and removing runtime fields
165+
166+
You can update or remove runtime fields at any time. To replace an existing
167+
runtime field, add a new runtime field to the mappings with the same name. To
168+
remove a runtime field from the mappings, set the value of the runtime field to
169+
`null`:
157170

171+
[source,console]
172+
----
173+
PUT my-index/_mapping
174+
{
175+
"runtime": {
176+
"day_of_week": null
177+
}
178+
}
179+
----
180+
//TEST[continued]
181+
182+
.Downstream impacts
183+
****
158184
Updating or removing a runtime field while a dependent query is running can return
159185
inconsistent results. Each shard might have access to different versions of the
160186
script, depending on when the mapping change takes effect.
@@ -163,7 +189,6 @@ Existing queries or visualizations in {kib} that rely on runtime fields can
163189
fail if you remove or update the field. For example, a bar chart visualization
164190
that uses a runtime field of type `ip` will fail if the type is changed
165191
to `boolean`, or if the runtime field is removed.
166-
167192
****
168193

169194
[[runtime-search-request]]
@@ -213,27 +238,6 @@ runtime field from a search request to the index mapping by moving the field
213238
definition from `runtime_mappings` in the search request to the `runtime`
214239
section of the index mapping.
215240

216-
[[runtime-fields-scriptless]]
217-
==== Define runtime fields without a script
218-
You can define a runtime field in the mapping definition without a
219-
script. At query time, {es} looks in `_source` for a field with the same name
220-
and returns a value if one exists. If a field with the same name doesn’t
221-
exist, the response doesn't include any values for that runtime field.
222-
223-
[source,console]
224-
----
225-
PUT my-index/
226-
{
227-
"mappings": {
228-
"runtime": {
229-
"model_number": {
230-
"type": "keyword"
231-
}
232-
}
233-
}
234-
}
235-
----
236-
237241
[[runtime-override-values]]
238242
=== Override field values at query time
239243
beta::[]

0 commit comments

Comments
 (0)