diff --git a/docs/reference/modules/scripting/fields.asciidoc b/docs/reference/modules/scripting/fields.asciidoc index 1225d16333fce..bdd6c5785d81c 100644 --- a/docs/reference/modules/scripting/fields.asciidoc +++ b/docs/reference/modules/scripting/fields.asciidoc @@ -115,6 +115,17 @@ Doc-values can only return "simple" field values like numbers, dates, geo- points, terms, etc, or arrays of these values if the field is multi-valued. It cannot return JSON objects. +[NOTE] +.Missing fields +=================================================== + +The `doc['field']` will throw an error if `field` is missing from the mappings. +In `painless`, a check can first be done with `doc.containsKey('field')` to guard +accessing the `doc` map. Unfortunately, there is no way to check for the +existence of the field in mappings in an `expression` script. + +=================================================== + [NOTE] .Doc values and `text` fields ===================================================