Skip to content

Commit

Permalink
[DOCS] Relocate scriptless runtime document (#68916)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
occidere and Adam Locke authored Feb 17, 2021
1 parent 1195b20 commit 42bca5b
Showing 1 changed file with 39 additions and 35 deletions.
74 changes: 39 additions & 35 deletions docs/reference/mapping/runtime.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,48 @@ PUT my-index
}
----

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`:

[source,console]
----
PUT my-index/_mapping
{
"runtime": {
"day_of_week": null
}
}
----
[[runtime-fields-scriptless]]
==== Define runtime fields without a script
You can define a runtime field in the mapping definition without a
script. At query time, {es} looks in `_source` for a field with the same name
and returns a value if one exists. If a field with the same name doesn’t
exist, the response doesn't include any values for that runtime field.

[source,console]
----
PUT my-index/
{
"mappings": {
"runtime": {
"day_of_week": {
"type": "keyword"
}
}
}
}
----

[[runtime-updating-scripts]]
.Updating and removing runtime fields
****
==== Updating and removing runtime fields

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`:

[source,console]
----
PUT my-index/_mapping
{
"runtime": {
"day_of_week": null
}
}
----
//TEST[continued]

.Downstream impacts
****
Updating or removing a runtime field while a dependent query is running can return
inconsistent results. Each shard might have access to different versions of the
script, depending on when the mapping change takes effect.
Expand All @@ -163,7 +189,6 @@ Existing queries or visualizations in {kib} that rely on runtime fields can
fail if you remove or update the field. For example, a bar chart visualization
that uses a runtime field of type `ip` will fail if the type is changed
to `boolean`, or if the runtime field is removed.
****

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

[[runtime-fields-scriptless]]
==== Define runtime fields without a script
You can define a runtime field in the mapping definition without a
script. At query time, {es} looks in `_source` for a field with the same name
and returns a value if one exists. If a field with the same name doesn’t
exist, the response doesn't include any values for that runtime field.

[source,console]
----
PUT my-index/
{
"mappings": {
"runtime": {
"model_number": {
"type": "keyword"
}
}
}
}
----

[[runtime-override-values]]
=== Override field values at query time
beta::[]
Expand Down

0 comments on commit 42bca5b

Please sign in to comment.