@@ -9,13 +9,13 @@ dynamically added fields based on:
9
9
* the full dotted path to the field, with <<path-match-unmatch,`path_match` and `path_unmatch`>>.
10
10
11
11
The original field name `{name}` and the detected datatype
12
- `{dynamic_type`} <<template-variables,template variables>> can be used in
12
+ `{dynamic_type}` <<template-variables,template variables>> can be used in
13
13
the mapping specification as placeholders.
14
14
15
15
IMPORTANT: Dynamic field mappings are only added when a field contains a
16
16
concrete value -- not `null` or an empty array. This means that if the
17
- `null_value` option is used in a `dynamic_template`, it will only be applied
18
- after the first document with a concrete value for the field has been
17
+ `null_value` option is used in a `dynamic_template`, it will only be applied
18
+ after the first document with a concrete value for the field has been
19
19
indexed.
20
20
21
21
Dynamic templates are specified as an array of named objects:
@@ -37,19 +37,20 @@ Dynamic templates are specified as an array of named objects:
37
37
<2> The match conditions can include any of : `match_mapping_type`, `match`, `match_pattern`, `unmatch`, `path_match`, `path_unmatch`.
38
38
<3> The mapping that the matched field should use.
39
39
40
- If a provided mapping contains an invalid mapping snippet then that results in
41
- a validation error. Validation always occurs when applying the dynamic template
42
- at index time or in most cases when updating the dynamic template.
40
+ If a provided mapping contains an invalid mapping snippet, a validation error
41
+ is returned. Validation occurs when applying the dynamic template at index time,
42
+ and, in most cases, when the dynamic template is updated. Providing an invalid mapping
43
+ snippet may cause the update or validation of a dynamic template to fail under certain conditions:
43
44
44
- Whether updating the dynamic template fails when supplying an invalid mapping snippet depends on the following:
45
- * If no `match_mapping_type` has been specified then if the template is valid with one predefined mapping type then
46
- the mapping snippet is considered valid. However if at index time a field that matches with the template is indexed
47
- as a different type then an validation error will occur at index time instead. For example configuring a dynamic
48
- template with no `match_mapping_type` is considered valid as string type, but at index time a field that matches with
49
- the dynamic template is indexed as a long, then at index time a validation error may still occur.
50
- * If the `{{name}}` placeholder is used in the mapping snippet then the validation is skipped when updating
51
- the dynamic template. This is because the field name is unknown at that time. The validation will then occur
52
- when applying the template at index time.
45
+ * If no `match_mapping_type` has been specified but the template is valid for at least one predefined mapping type,
46
+ the mapping snippet is considered valid. However, a validation error is returned at index time if a field matching
47
+ the template is indexed as a different type. For example, configuring a dynamic template with no `match_mapping_type`
48
+ is considered valid as string type, but if a field matching the dynamic template is indexed as a long, a validation
49
+ error is returned at index time.
50
+
51
+ * If the `{{name}}` placeholder is used in the mapping snippet, validation is skipped when updating the dynamic
52
+ template. This is because the field name is unknown at that time. Instead, validation occurs when the template is applied
53
+ at index time.
53
54
54
55
Templates are processed in order -- the first matching template wins. When
55
56
putting new dynamic templates through the <<indices-put-mapping, put mapping>> API,
@@ -59,16 +60,16 @@ reordered or deleted after they were initially added.
59
60
[[match-mapping-type]]
60
61
==== `match_mapping_type`
61
62
62
- The `match_mapping_type` is the datatype detected by the json parser. Since
63
- JSON doesn't allow to distinguish a `long` from an `integer` or a `double` from
63
+ The `match_mapping_type` is the datatype detected by the JSON parser. Since
64
+ JSON doesn't distinguish a `long` from an `integer` or a `double` from
64
65
a `float`, it will always choose the wider datatype, i.e. `long` for integers
65
66
and `double` for floating-point numbers.
66
67
67
68
The following datatypes may be automatically detected:
68
69
69
70
- `boolean` when `true` or `false` are encountered.
70
- - `date` when <<date-detection,date detection>> is enabled and a string is
71
- found that matches any of the configured date formats.
71
+ - `date` when <<date-detection,date detection>> is enabled and a string matching
72
+ any of the configured date formats is found .
72
73
- `double` for numbers with a decimal part.
73
74
- `long` for numbers without a decimal part.
74
75
- `object` for objects, also called hashes.
0 commit comments