Skip to content

Commit a8e1ee3

Browse files
authored
ingest: document fields that support templating (#34536)
This change also updates many of the examples to use ecs as the example. Some additional minor improvements are also included. Part of #33188
1 parent e242fd2 commit a8e1ee3

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

docs/reference/ingest/ingest-node.asciidoc

+32-31
Original file line numberDiff line numberDiff line change
@@ -776,16 +776,16 @@ Accepts a single value or an array of values.
776776
[options="header"]
777777
|======
778778
| Name | Required | Default | Description
779-
| `field` | yes | - | The field to be appended to
780-
| `value` | yes | - | The value to be appended
779+
| `field` | yes | - | The field to be appended to. Supports <<accessing-template-fields,template snippets>>.
780+
| `value` | yes | - | The value to be appended. Supports <<accessing-template-fields,template snippets>>.
781781
|======
782782

783783
[source,js]
784784
--------------------------------------------------
785785
{
786786
"append": {
787-
"field": "field1",
788-
"value": ["item2", "item3", "item4"]
787+
"field": "tags",
788+
"value": ["production", "{{app}}", "{{owner}}"]
789789
}
790790
}
791791
--------------------------------------------------
@@ -812,7 +812,7 @@ the field is not a supported format or resultant value exceeds 2^63.
812812
--------------------------------------------------
813813
{
814814
"bytes": {
815-
"field": "foo"
815+
"field": "file.size"
816816
}
817817
}
818818
--------------------------------------------------
@@ -850,7 +850,7 @@ still be updated with the unconverted field value.
850850
--------------------------------------------------
851851
{
852852
"convert": {
853-
"field" : "foo",
853+
"field" : "url.port",
854854
"type": "integer"
855855
}
856856
}
@@ -874,8 +874,8 @@ in the same order they were defined as part of the processor definition.
874874
| `field` | yes | - | The field to get the date from.
875875
| `target_field` | no | @timestamp | The field that will hold the parsed date.
876876
| `formats` | yes | - | An array of the expected date formats. Can be a Joda pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N.
877-
| `timezone` | no | UTC | The timezone to use when parsing the date.
878-
| `locale` | no | ENGLISH | The locale to use when parsing the date, relevant when parsing month names or week days.
877+
| `timezone` | no | UTC | The timezone to use when parsing the date. Supports <<accessing-template-fields,template snippets>>.
878+
| `locale` | no | ENGLISH | The locale to use when parsing the date, relevant when parsing month names or week days. Supports <<accessing-template-fields,template snippets>>.
879879
|======
880880

881881
Here is an example that adds the parsed date to the `timestamp` field based on the `initial_date` field:
@@ -913,8 +913,8 @@ the timezone and locale values.
913913
"field" : "initial_date",
914914
"target_field" : "timestamp",
915915
"formats" : ["ISO8601"],
916-
"timezone" : "{{ my_timezone }}",
917-
"locale" : "{{ my_locale }}"
916+
"timezone" : "{{my_timezone}}",
917+
"locale" : "{{my_locale}}"
918918
}
919919
}
920920
]
@@ -1059,12 +1059,12 @@ understands this to mean `2016-04-01` as is explained in the <<date-math-index-n
10591059
|======
10601060
| Name | Required | Default | Description
10611061
| `field` | yes | - | The field to get the date or timestamp from.
1062-
| `index_name_prefix` | no | - | A prefix of the index name to be prepended before the printed date.
1063-
| `date_rounding` | yes | - | How to round the date when formatting the date into the index name. Valid values are: `y` (year), `M` (month), `w` (week), `d` (day), `h` (hour), `m` (minute) and `s` (second).
1062+
| `index_name_prefix` | no | - | A prefix of the index name to be prepended before the printed date. Supports <<accessing-template-fields,template snippets>>.
1063+
| `date_rounding` | yes | - | How to round the date when formatting the date into the index name. Valid values are: `y` (year), `M` (month), `w` (week), `d` (day), `h` (hour), `m` (minute) and `s` (second). Supports <<accessing-template-fields,template snippets>>.
10641064
| `date_formats` | no | yyyy-MM-dd'T'HH:mm:ss.SSSZ | An array of the expected date formats for parsing dates / timestamps in the document being preprocessed. Can be a Joda pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N.
10651065
| `timezone` | no | UTC | The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
10661066
| `locale` | no | ENGLISH | The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
1067-
| `index_name_format` | no | yyyy-MM-dd | The format to be used when printing the parsed date into the index name. An valid Joda pattern is expected here.
1067+
| `index_name_format` | no | yyyy-MM-dd | The format to be used when printing the parsed date into the index name. An valid Joda pattern is expected here. Supports <<accessing-template-fields,template snippets>>.
10681068
|======
10691069

10701070
[[dissect-processor]]
@@ -1405,14 +1405,15 @@ to the requester.
14051405
[options="header"]
14061406
|======
14071407
| Name | Required | Default | Description
1408-
| `message` | yes | - | The error message of the `FailException` thrown by the processor
1408+
| `message` | yes | - | The error message thrown by the processor. Supports <<accessing-template-fields,template snippets>>.
14091409
|======
14101410

14111411
[source,js]
14121412
--------------------------------------------------
14131413
{
14141414
"fail": {
1415-
"message": "an error message"
1415+
"if" : "ctx.tags.contains('production') != true",
1416+
"message": "The production tag is not present, found tags: {{tags}}"
14161417
}
14171418
}
14181419
--------------------------------------------------
@@ -2117,7 +2118,7 @@ Removes existing fields. If one field doesn't exist, an exception will be thrown
21172118
[options="header"]
21182119
|======
21192120
| Name | Required | Default | Description
2120-
| `field` | yes | - | Fields to be removed
2121+
| `field` | yes | - | Fields to be removed. Supports <<accessing-template-fields,template snippets>>.
21212122
| `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
21222123
|======
21232124

@@ -2127,7 +2128,7 @@ Here is an example to remove a single field:
21272128
--------------------------------------------------
21282129
{
21292130
"remove": {
2130-
"field": "foo"
2131+
"field": "user_agent"
21312132
}
21322133
}
21332134
--------------------------------------------------
@@ -2139,7 +2140,7 @@ To remove multiple fields, you can use the following query:
21392140
--------------------------------------------------
21402141
{
21412142
"remove": {
2142-
"field": ["foo", "bar"]
2143+
"field": ["user_agent", "url"]
21432144
}
21442145
}
21452146
--------------------------------------------------
@@ -2153,18 +2154,18 @@ Renames an existing field. If the field doesn't exist or the new name is already
21532154
.Rename Options
21542155
[options="header"]
21552156
|======
2156-
| Name | Required | Default | Description
2157-
| `field` | yes | - | The field to be renamed
2158-
| `target_field` | yes | - | The new name of the field
2159-
| `ignore_missing` | no | `false` | If `true` and `field` does not exist, the processor quietly exits without modifying the document
2157+
| Name | Required | Default | Description
2158+
| `field` | yes | - | The field to be renamed. Supports <<accessing-template-fields,template snippets>>.
2159+
| `target_field` | yes | - | The new name of the field. Supports <<accessing-template-fields,template snippets>>.
2160+
| `ignore_missing` | no | `false` | If `true` and `field` does not exist, the processor quietly exits without modifying the document
21602161
|======
21612162

21622163
[source,js]
21632164
--------------------------------------------------
21642165
{
21652166
"rename": {
2166-
"field": "foo",
2167-
"target_field": "foobar"
2167+
"field": "provider",
2168+
"target_field": "cloud.provider"
21682169
}
21692170
}
21702171
--------------------------------------------------
@@ -2282,18 +2283,18 @@ its value will be replaced with the provided one.
22822283
.Set Options
22832284
[options="header"]
22842285
|======
2285-
| Name | Required | Default | Description
2286-
| `field` | yes | - | The field to insert, upsert, or update
2287-
| `value` | yes | - | The value to be set for the field
2288-
| `override`| no | true | If processor will update fields with pre-existing non-null-valued field. When set to `false`, such fields will not be touched.
2286+
| Name | Required | Default | Description
2287+
| `field` | yes | - | The field to insert, upsert, or update. Supports <<accessing-template-fields,template snippets>>.
2288+
| `value` | yes | - | The value to be set for the field. Supports <<accessing-template-fields,template snippets>>.
2289+
| `override` | no | true | If processor will update fields with pre-existing non-null-valued field. When set to `false`, such fields will not be touched.
22892290
|======
22902291

22912292
[source,js]
22922293
--------------------------------------------------
22932294
{
22942295
"set": {
2295-
"field": "field1",
2296-
"value": 582.1
2296+
"field": "host.os.name",
2297+
"value": "{{os}}"
22972298
}
22982299
}
22992300
--------------------------------------------------
@@ -2346,7 +2347,7 @@ Throws an error when the field is not an array.
23462347
--------------------------------------------------
23472348
{
23482349
"sort": {
2349-
"field": "field_to_sort",
2350+
"field": "array_field_to_sort",
23502351
"order": "desc"
23512352
}
23522353
}

0 commit comments

Comments
 (0)