|
@@ -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.
|
|
@@ -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]]
|
|
@@ -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::[]
|