ingest-node.asciidoc 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151
  1. [[pipeline]]
  2. == Pipeline Definition
  3. A pipeline is a definition of a series of <<ingest-processors, processors>> that are to be executed
  4. in the same order as they are declared. A pipeline consists of two main fields: a `description`
  5. and a list of `processors`:
  6. [source,js]
  7. --------------------------------------------------
  8. {
  9. "description" : "...",
  10. "processors" : [ ... ]
  11. }
  12. --------------------------------------------------
  13. // NOTCONSOLE
  14. The `description` is a special field to store a helpful description of
  15. what the pipeline does.
  16. The `processors` parameter defines a list of processors to be executed in
  17. order.
  18. [[ingest-apis]]
  19. == Ingest APIs
  20. The following ingest APIs are available for managing pipelines:
  21. * <<put-pipeline-api>> to add or update a pipeline
  22. * <<get-pipeline-api>> to return a specific pipeline
  23. * <<delete-pipeline-api>> to delete a pipeline
  24. * <<simulate-pipeline-api>> to simulate a call to a pipeline
  25. [[put-pipeline-api]]
  26. === Put Pipeline API
  27. The put pipeline API adds pipelines and updates existing pipelines in the cluster.
  28. [source,js]
  29. --------------------------------------------------
  30. PUT _ingest/pipeline/my-pipeline-id
  31. {
  32. "description" : "describe pipeline",
  33. "processors" : [
  34. {
  35. "set" : {
  36. "field": "foo",
  37. "value": "bar"
  38. }
  39. }
  40. ]
  41. }
  42. --------------------------------------------------
  43. // CONSOLE
  44. NOTE: The put pipeline API also instructs all ingest nodes to reload their in-memory representation of pipelines, so that
  45. pipeline changes take effect immediately.
  46. [[get-pipeline-api]]
  47. === Get Pipeline API
  48. The get pipeline API returns pipelines based on ID. This API always returns a local reference of the pipeline.
  49. [source,js]
  50. --------------------------------------------------
  51. GET _ingest/pipeline/my-pipeline-id
  52. --------------------------------------------------
  53. // CONSOLE
  54. // TEST[continued]
  55. Example response:
  56. [source,js]
  57. --------------------------------------------------
  58. {
  59. "my-pipeline-id" : {
  60. "description" : "describe pipeline",
  61. "processors" : [
  62. {
  63. "set" : {
  64. "field" : "foo",
  65. "value" : "bar"
  66. }
  67. }
  68. ]
  69. }
  70. }
  71. --------------------------------------------------
  72. // TESTRESPONSE
  73. For each returned pipeline, the source and the version are returned.
  74. The version is useful for knowing which version of the pipeline the node has.
  75. You can specify multiple IDs to return more than one pipeline. Wildcards are also supported.
  76. [float]
  77. [[versioning-pipelines]]
  78. ==== Pipeline Versioning
  79. Pipelines can optionally add a `version` number, which can be any integer value,
  80. in order to simplify pipeline management by external systems. The `version`
  81. field is completely optional and it is meant solely for external management of
  82. pipelines. To unset a `version`, simply replace the pipeline without specifying
  83. one.
  84. [source,js]
  85. --------------------------------------------------
  86. PUT _ingest/pipeline/my-pipeline-id
  87. {
  88. "description" : "describe pipeline",
  89. "version" : 123,
  90. "processors" : [
  91. {
  92. "set" : {
  93. "field": "foo",
  94. "value": "bar"
  95. }
  96. }
  97. ]
  98. }
  99. --------------------------------------------------
  100. // CONSOLE
  101. To check for the `version`, you can
  102. <<common-options-response-filtering, filter responses>>
  103. using `filter_path` to limit the response to just the `version`:
  104. [source,js]
  105. --------------------------------------------------
  106. GET /_ingest/pipeline/my-pipeline-id?filter_path=*.version
  107. --------------------------------------------------
  108. // CONSOLE
  109. // TEST[continued]
  110. This should give a small response that makes it both easy and inexpensive to parse:
  111. [source,js]
  112. --------------------------------------------------
  113. {
  114. "my-pipeline-id" : {
  115. "version" : 123
  116. }
  117. }
  118. --------------------------------------------------
  119. // TESTRESPONSE
  120. [[delete-pipeline-api]]
  121. === Delete Pipeline API
  122. The delete pipeline API deletes pipelines by ID or wildcard match (`my-*`, `*`).
  123. [source,js]
  124. --------------------------------------------------
  125. DELETE _ingest/pipeline/my-pipeline-id
  126. --------------------------------------------------
  127. // CONSOLE
  128. // TEST[continued]
  129. ////
  130. Hidden setup for wildcard test:
  131. [source,js]
  132. --------------------------------------------------
  133. PUT _ingest/pipeline/wild-one
  134. {
  135. "description" : "first pipeline to be wildcard deleted",
  136. "processors" : [ ]
  137. }
  138. PUT _ingest/pipeline/wild-two
  139. {
  140. "description" : "second pipeline to be wildcard deleted",
  141. "processors" : [ ]
  142. }
  143. DELETE _ingest/pipeline/*
  144. --------------------------------------------------
  145. // CONSOLE
  146. Hidden expected response:
  147. [source,js]
  148. --------------------------------------------------
  149. {
  150. "acknowledged": true
  151. }
  152. --------------------------------------------------
  153. // TESTRESPONSE
  154. ////
  155. [[simulate-pipeline-api]]
  156. === Simulate Pipeline API
  157. The simulate pipeline API executes a specific pipeline against
  158. the set of documents provided in the body of the request.
  159. You can either specify an existing pipeline to execute
  160. against the provided documents, or supply a pipeline definition in
  161. the body of the request.
  162. Here is the structure of a simulate request with a pipeline definition provided
  163. in the body of the request:
  164. [source,js]
  165. --------------------------------------------------
  166. POST _ingest/pipeline/_simulate
  167. {
  168. "pipeline" : {
  169. // pipeline definition here
  170. },
  171. "docs" : [
  172. { "_source": {/** first document **/} },
  173. { "_source": {/** second document **/} },
  174. // ...
  175. ]
  176. }
  177. --------------------------------------------------
  178. // NOTCONSOLE
  179. Here is the structure of a simulate request against an existing pipeline:
  180. [source,js]
  181. --------------------------------------------------
  182. POST _ingest/pipeline/my-pipeline-id/_simulate
  183. {
  184. "docs" : [
  185. { "_source": {/** first document **/} },
  186. { "_source": {/** second document **/} },
  187. // ...
  188. ]
  189. }
  190. --------------------------------------------------
  191. // NOTCONSOLE
  192. Here is an example of a simulate request with a pipeline defined in the request
  193. and its response:
  194. [source,js]
  195. --------------------------------------------------
  196. POST _ingest/pipeline/_simulate
  197. {
  198. "pipeline" :
  199. {
  200. "description": "_description",
  201. "processors": [
  202. {
  203. "set" : {
  204. "field" : "field2",
  205. "value" : "_value"
  206. }
  207. }
  208. ]
  209. },
  210. "docs": [
  211. {
  212. "_index": "index",
  213. "_type": "_doc",
  214. "_id": "id",
  215. "_source": {
  216. "foo": "bar"
  217. }
  218. },
  219. {
  220. "_index": "index",
  221. "_type": "_doc",
  222. "_id": "id",
  223. "_source": {
  224. "foo": "rab"
  225. }
  226. }
  227. ]
  228. }
  229. --------------------------------------------------
  230. // CONSOLE
  231. Response:
  232. [source,js]
  233. --------------------------------------------------
  234. {
  235. "docs": [
  236. {
  237. "doc": {
  238. "_id": "id",
  239. "_index": "index",
  240. "_type": "_doc",
  241. "_source": {
  242. "field2": "_value",
  243. "foo": "bar"
  244. },
  245. "_ingest": {
  246. "timestamp": "2017-05-04T22:30:03.187Z"
  247. }
  248. }
  249. },
  250. {
  251. "doc": {
  252. "_id": "id",
  253. "_index": "index",
  254. "_type": "_doc",
  255. "_source": {
  256. "field2": "_value",
  257. "foo": "rab"
  258. },
  259. "_ingest": {
  260. "timestamp": "2017-05-04T22:30:03.188Z"
  261. }
  262. }
  263. }
  264. ]
  265. }
  266. --------------------------------------------------
  267. // TESTRESPONSE[s/"2017-05-04T22:30:03.187Z"/$body.docs.0.doc._ingest.timestamp/]
  268. // TESTRESPONSE[s/"2017-05-04T22:30:03.188Z"/$body.docs.1.doc._ingest.timestamp/]
  269. [[ingest-verbose-param]]
  270. ==== Viewing Verbose Results
  271. You can use the simulate pipeline API to see how each processor affects the ingest document
  272. as it passes through the pipeline. To see the intermediate results of
  273. each processor in the simulate request, you can add the `verbose` parameter
  274. to the request.
  275. Here is an example of a verbose request and its response:
  276. [source,js]
  277. --------------------------------------------------
  278. POST _ingest/pipeline/_simulate?verbose
  279. {
  280. "pipeline" :
  281. {
  282. "description": "_description",
  283. "processors": [
  284. {
  285. "set" : {
  286. "field" : "field2",
  287. "value" : "_value2"
  288. }
  289. },
  290. {
  291. "set" : {
  292. "field" : "field3",
  293. "value" : "_value3"
  294. }
  295. }
  296. ]
  297. },
  298. "docs": [
  299. {
  300. "_index": "index",
  301. "_type": "_doc",
  302. "_id": "id",
  303. "_source": {
  304. "foo": "bar"
  305. }
  306. },
  307. {
  308. "_index": "index",
  309. "_type": "_doc",
  310. "_id": "id",
  311. "_source": {
  312. "foo": "rab"
  313. }
  314. }
  315. ]
  316. }
  317. --------------------------------------------------
  318. // CONSOLE
  319. Response:
  320. [source,js]
  321. --------------------------------------------------
  322. {
  323. "docs": [
  324. {
  325. "processor_results": [
  326. {
  327. "doc": {
  328. "_id": "id",
  329. "_index": "index",
  330. "_type": "_doc",
  331. "_source": {
  332. "field2": "_value2",
  333. "foo": "bar"
  334. },
  335. "_ingest": {
  336. "timestamp": "2017-05-04T22:46:09.674Z"
  337. }
  338. }
  339. },
  340. {
  341. "doc": {
  342. "_id": "id",
  343. "_index": "index",
  344. "_type": "_doc",
  345. "_source": {
  346. "field3": "_value3",
  347. "field2": "_value2",
  348. "foo": "bar"
  349. },
  350. "_ingest": {
  351. "timestamp": "2017-05-04T22:46:09.675Z"
  352. }
  353. }
  354. }
  355. ]
  356. },
  357. {
  358. "processor_results": [
  359. {
  360. "doc": {
  361. "_id": "id",
  362. "_index": "index",
  363. "_type": "_doc",
  364. "_source": {
  365. "field2": "_value2",
  366. "foo": "rab"
  367. },
  368. "_ingest": {
  369. "timestamp": "2017-05-04T22:46:09.676Z"
  370. }
  371. }
  372. },
  373. {
  374. "doc": {
  375. "_id": "id",
  376. "_index": "index",
  377. "_type": "_doc",
  378. "_source": {
  379. "field3": "_value3",
  380. "field2": "_value2",
  381. "foo": "rab"
  382. },
  383. "_ingest": {
  384. "timestamp": "2017-05-04T22:46:09.677Z"
  385. }
  386. }
  387. }
  388. ]
  389. }
  390. ]
  391. }
  392. --------------------------------------------------
  393. // TESTRESPONSE[s/"2017-05-04T22:46:09.674Z"/$body.docs.0.processor_results.0.doc._ingest.timestamp/]
  394. // TESTRESPONSE[s/"2017-05-04T22:46:09.675Z"/$body.docs.0.processor_results.1.doc._ingest.timestamp/]
  395. // TESTRESPONSE[s/"2017-05-04T22:46:09.676Z"/$body.docs.1.processor_results.0.doc._ingest.timestamp/]
  396. // TESTRESPONSE[s/"2017-05-04T22:46:09.677Z"/$body.docs.1.processor_results.1.doc._ingest.timestamp/]
  397. [[accessing-data-in-pipelines]]
  398. == Accessing Data in Pipelines
  399. The processors in a pipeline have read and write access to documents that pass through the pipeline.
  400. The processors can access fields in the source of a document and the document's metadata fields.
  401. [float]
  402. [[accessing-source-fields]]
  403. === Accessing Fields in the Source
  404. Accessing a field in the source is straightforward. You simply refer to fields by
  405. their name. For example:
  406. [source,js]
  407. --------------------------------------------------
  408. {
  409. "set": {
  410. "field": "my_field",
  411. "value": 582.1
  412. }
  413. }
  414. --------------------------------------------------
  415. // NOTCONSOLE
  416. On top of this, fields from the source are always accessible via the `_source` prefix:
  417. [source,js]
  418. --------------------------------------------------
  419. {
  420. "set": {
  421. "field": "_source.my_field",
  422. "value": 582.1
  423. }
  424. }
  425. --------------------------------------------------
  426. // NOTCONSOLE
  427. [float]
  428. [[accessing-metadata-fields]]
  429. === Accessing Metadata Fields
  430. You can access metadata fields in the same way that you access fields in the source. This
  431. is possible because Elasticsearch doesn't allow fields in the source that have the
  432. same name as metadata fields.
  433. The following example sets the `_id` metadata field of a document to `1`:
  434. [source,js]
  435. --------------------------------------------------
  436. {
  437. "set": {
  438. "field": "_id",
  439. "value": "1"
  440. }
  441. }
  442. --------------------------------------------------
  443. // NOTCONSOLE
  444. The following metadata fields are accessible by a processor: `_index`, `_type`, `_id`, `_routing`.
  445. [float]
  446. [[accessing-ingest-metadata]]
  447. === Accessing Ingest Metadata Fields
  448. Beyond metadata fields and source fields, ingest also adds ingest metadata to the documents that it processes.
  449. These metadata properties are accessible under the `_ingest` key. Currently ingest adds the ingest timestamp
  450. under the `_ingest.timestamp` key of the ingest metadata. The ingest timestamp is the time when Elasticsearch
  451. received the index or bulk request to pre-process the document.
  452. Any processor can add ingest-related metadata during document processing. Ingest metadata is transient
  453. and is lost after a document has been processed by the pipeline. Therefore, ingest metadata won't be indexed.
  454. The following example adds a field with the name `received`. The value is the ingest timestamp:
  455. [source,js]
  456. --------------------------------------------------
  457. {
  458. "set": {
  459. "field": "received",
  460. "value": "{{_ingest.timestamp}}"
  461. }
  462. }
  463. --------------------------------------------------
  464. // NOTCONSOLE
  465. Unlike Elasticsearch metadata fields, the ingest metadata field name `_ingest` can be used as a valid field name
  466. in the source of a document. Use `_source._ingest` to refer to the field in the source document. Otherwise, `_ingest`
  467. will be interpreted as an ingest metadata field.
  468. [float]
  469. [[accessing-template-fields]]
  470. === Accessing Fields and Metafields in Templates
  471. A number of processor settings also support templating. Settings that support templating can have zero or more
  472. template snippets. A template snippet begins with `{{` and ends with `}}`.
  473. Accessing fields and metafields in templates is exactly the same as via regular processor field settings.
  474. The following example adds a field named `field_c`. Its value is a concatenation of
  475. the values of `field_a` and `field_b`.
  476. [source,js]
  477. --------------------------------------------------
  478. {
  479. "set": {
  480. "field": "field_c",
  481. "value": "{{field_a}} {{field_b}}"
  482. }
  483. }
  484. --------------------------------------------------
  485. // NOTCONSOLE
  486. The following example uses the value of the `geoip.country_iso_code` field in the source
  487. to set the index that the document will be indexed into:
  488. [source,js]
  489. --------------------------------------------------
  490. {
  491. "set": {
  492. "field": "_index",
  493. "value": "{{geoip.country_iso_code}}"
  494. }
  495. }
  496. --------------------------------------------------
  497. // NOTCONSOLE
  498. Dynamic field names are also supported. This example sets the field named after the
  499. value of `service` to the value of the field `code`:
  500. [source,js]
  501. --------------------------------------------------
  502. {
  503. "set": {
  504. "field": "{{service}}",
  505. "value": "{{code}}"
  506. }
  507. }
  508. --------------------------------------------------
  509. // NOTCONSOLE
  510. [[handling-failure-in-pipelines]]
  511. == Handling Failures in Pipelines
  512. In its simplest use case, a pipeline defines a list of processors that
  513. are executed sequentially, and processing halts at the first exception. This
  514. behavior may not be desirable when failures are expected. For example, you may have logs
  515. that don't match the specified grok expression. Instead of halting execution, you may
  516. want to index such documents into a separate index.
  517. To enable this behavior, you can use the `on_failure` parameter. The `on_failure` parameter
  518. defines a list of processors to be executed immediately following the failed processor.
  519. You can specify this parameter at the pipeline level, as well as at the processor
  520. level. If a processor specifies an `on_failure` configuration, whether
  521. it is empty or not, any exceptions that are thrown by the processor are caught, and the
  522. pipeline continues executing the remaining processors. Because you can define further processors
  523. within the scope of an `on_failure` statement, you can nest failure handling.
  524. The following example defines a pipeline that renames the `foo` field in
  525. the processed document to `bar`. If the document does not contain the `foo` field, the processor
  526. attaches an error message to the document for later analysis within
  527. Elasticsearch.
  528. [source,js]
  529. --------------------------------------------------
  530. {
  531. "description" : "my first pipeline with handled exceptions",
  532. "processors" : [
  533. {
  534. "rename" : {
  535. "field" : "foo",
  536. "target_field" : "bar",
  537. "on_failure" : [
  538. {
  539. "set" : {
  540. "field" : "error",
  541. "value" : "field \"foo\" does not exist, cannot rename to \"bar\""
  542. }
  543. }
  544. ]
  545. }
  546. }
  547. ]
  548. }
  549. --------------------------------------------------
  550. // NOTCONSOLE
  551. The following example defines an `on_failure` block on a whole pipeline to change
  552. the index to which failed documents get sent.
  553. [source,js]
  554. --------------------------------------------------
  555. {
  556. "description" : "my first pipeline with handled exceptions",
  557. "processors" : [ ... ],
  558. "on_failure" : [
  559. {
  560. "set" : {
  561. "field" : "_index",
  562. "value" : "failed-{{ _index }}"
  563. }
  564. }
  565. ]
  566. }
  567. --------------------------------------------------
  568. // NOTCONSOLE
  569. Alternatively instead of defining behaviour in case of processor failure, it is also possible
  570. to ignore a failure and continue with the next processor by specifying the `ignore_failure` setting.
  571. In case in the example below the field `foo` doesn't exist the failure will be caught and the pipeline
  572. continues to execute, which in this case means that the pipeline does nothing.
  573. [source,js]
  574. --------------------------------------------------
  575. {
  576. "description" : "my first pipeline with handled exceptions",
  577. "processors" : [
  578. {
  579. "rename" : {
  580. "field" : "foo",
  581. "target_field" : "bar",
  582. "ignore_failure" : true
  583. }
  584. }
  585. ]
  586. }
  587. --------------------------------------------------
  588. // NOTCONSOLE
  589. The `ignore_failure` can be set on any processor and defaults to `false`.
  590. [float]
  591. [[accessing-error-metadata]]
  592. === Accessing Error Metadata From Processors Handling Exceptions
  593. You may want to retrieve the actual error message that was thrown
  594. by a failed processor. To do so you can access metadata fields called
  595. `on_failure_message`, `on_failure_processor_type`, and `on_failure_processor_tag`. These fields are only accessible
  596. from within the context of an `on_failure` block.
  597. Here is an updated version of the example that you
  598. saw earlier. But instead of setting the error message manually, the example leverages the `on_failure_message`
  599. metadata field to provide the error message.
  600. [source,js]
  601. --------------------------------------------------
  602. {
  603. "description" : "my first pipeline with handled exceptions",
  604. "processors" : [
  605. {
  606. "rename" : {
  607. "field" : "foo",
  608. "to" : "bar",
  609. "on_failure" : [
  610. {
  611. "set" : {
  612. "field" : "error",
  613. "value" : "{{ _ingest.on_failure_message }}"
  614. }
  615. }
  616. ]
  617. }
  618. }
  619. ]
  620. }
  621. --------------------------------------------------
  622. // NOTCONSOLE
  623. [[ingest-processors]]
  624. == Processors
  625. All processors are defined in the following way within a pipeline definition:
  626. [source,js]
  627. --------------------------------------------------
  628. {
  629. "PROCESSOR_NAME" : {
  630. ... processor configuration options ...
  631. }
  632. }
  633. --------------------------------------------------
  634. // NOTCONSOLE
  635. Each processor defines its own configuration parameters, but all processors have
  636. the ability to declare `tag` and `on_failure` fields. These fields are optional.
  637. A `tag` is simply a string identifier of the specific instantiation of a certain
  638. processor in a pipeline. The `tag` field does not affect the processor's behavior,
  639. but is very useful for bookkeeping and tracing errors to specific processors.
  640. See <<handling-failure-in-pipelines>> to learn more about the `on_failure` field and error handling in pipelines.
  641. The <<ingest-info,node info API>> can be used to figure out what processors are available in a cluster.
  642. The <<ingest-info,node info API>> will provide a per node list of what processors are available.
  643. Custom processors must be installed on all nodes. The put pipeline API will fail if a processor specified in a pipeline
  644. doesn't exist on all nodes. If you rely on custom processor plugins make sure to mark these plugins as mandatory by adding
  645. `plugin.mandatory` setting to the `config/elasticsearch.yml` file, for example:
  646. [source,yaml]
  647. --------------------------------------------------
  648. plugin.mandatory: ingest-attachment,ingest-geoip
  649. --------------------------------------------------
  650. A node will not start if either of these plugins are not available.
  651. The <<ingest-stats,node stats API>> can be used to fetch ingest usage statistics, globally and on a per
  652. pipeline basis. Useful to find out which pipelines are used the most or spent the most time on preprocessing.
  653. [[append-processor]]
  654. === Append Processor
  655. Appends one or more values to an existing array if the field already exists and it is an array.
  656. Converts a scalar to an array and appends one or more values to it if the field exists and it is a scalar.
  657. Creates an array containing the provided values if the field doesn't exist.
  658. Accepts a single value or an array of values.
  659. [[append-options]]
  660. .Append Options
  661. [options="header"]
  662. |======
  663. | Name | Required | Default | Description
  664. | `field` | yes | - | The field to be appended to
  665. | `value` | yes | - | The value to be appended
  666. |======
  667. [source,js]
  668. --------------------------------------------------
  669. {
  670. "append": {
  671. "field": "field1",
  672. "value": ["item2", "item3", "item4"]
  673. }
  674. }
  675. --------------------------------------------------
  676. // NOTCONSOLE
  677. [[convert-processor]]
  678. === Convert Processor
  679. Converts an existing field's value to a different type, such as converting a string to an integer.
  680. If the field value is an array, all members will be converted.
  681. The supported types include: `integer`, `long`, `float`, `double`, `string`, `boolean`, and `auto`.
  682. Specifying `boolean` will set the field to true if its string value is equal to `true` (ignore case), to
  683. false if its string value is equal to `false` (ignore case), or it will throw an exception otherwise.
  684. Specifying `auto` will attempt to convert the string-valued `field` into the closest non-string type.
  685. For example, a field whose value is `"true"` will be converted to its respective boolean type: `true`. Do note
  686. that float takes precedence of double in `auto`. A value of `"242.15"` will "automatically" be converted to
  687. `242.15` of type `float`. If a provided field cannot be appropriately converted, the Convert Processor will
  688. still process successfully and leave the field value as-is. In such a case, `target_field` will
  689. still be updated with the unconverted field value.
  690. [[convert-options]]
  691. .Convert Options
  692. [options="header"]
  693. |======
  694. | Name | Required | Default | Description
  695. | `field` | yes | - | The field whose value is to be converted
  696. | `target_field` | no | `field` | The field to assign the converted value to, by default `field` is updated in-place
  697. | `type` | yes | - | The type to convert the existing value to
  698. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  699. |======
  700. [source,js]
  701. --------------------------------------------------
  702. {
  703. "convert": {
  704. "field" : "foo",
  705. "type": "integer"
  706. }
  707. }
  708. --------------------------------------------------
  709. // NOTCONSOLE
  710. [[date-processor]]
  711. === Date Processor
  712. Parses dates from fields, and then uses the date or timestamp as the timestamp for the document.
  713. By default, the date processor adds the parsed date as a new field called `@timestamp`. You can specify a
  714. different field by setting the `target_field` configuration parameter. Multiple date formats are supported
  715. as part of the same date processor definition. They will be used sequentially to attempt parsing the date field,
  716. in the same order they were defined as part of the processor definition.
  717. [[date-options]]
  718. .Date options
  719. [options="header"]
  720. |======
  721. | Name | Required | Default | Description
  722. | `field` | yes | - | The field to get the date from.
  723. | `target_field` | no | @timestamp | The field that will hold the parsed date.
  724. | `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.
  725. | `timezone` | no | UTC | The timezone to use when parsing the date.
  726. | `locale` | no | ENGLISH | The locale to use when parsing the date, relevant when parsing month names or week days.
  727. |======
  728. Here is an example that adds the parsed date to the `timestamp` field based on the `initial_date` field:
  729. [source,js]
  730. --------------------------------------------------
  731. {
  732. "description" : "...",
  733. "processors" : [
  734. {
  735. "date" : {
  736. "field" : "initial_date",
  737. "target_field" : "timestamp",
  738. "formats" : ["dd/MM/yyyy hh:mm:ss"],
  739. "timezone" : "Europe/Amsterdam"
  740. }
  741. }
  742. ]
  743. }
  744. --------------------------------------------------
  745. // NOTCONSOLE
  746. The `timezone` and `locale` processor parameters are templated. This means that their values can be
  747. extracted from fields within documents. The example below shows how to extract the locale/timezone
  748. details from existing fields, `my_timezone` and `my_locale`, in the ingested document that contain
  749. the timezone and locale values.
  750. [source,js]
  751. --------------------------------------------------
  752. {
  753. "description" : "...",
  754. "processors" : [
  755. {
  756. "date" : {
  757. "field" : "initial_date",
  758. "target_field" : "timestamp",
  759. "formats" : ["ISO8601"],
  760. "timezone" : "{{ my_timezone }}",
  761. "locale" : "{{ my_locale }}"
  762. }
  763. }
  764. ]
  765. }
  766. --------------------------------------------------
  767. // NOTCONSOLE
  768. [[date-index-name-processor]]
  769. === Date Index Name Processor
  770. The purpose of this processor is to point documents to the right time based index based
  771. on a date or timestamp field in a document by using the <<date-math-index-names, date math index name support>>.
  772. The processor sets the `_index` meta field with a date math index name expression based on the provided index name
  773. prefix, a date or timestamp field in the documents being processed and the provided date rounding.
  774. First, this processor fetches the date or timestamp from a field in the document being processed. Optionally,
  775. date formatting can be configured on how the field's value should be parsed into a date. Then this date,
  776. the provided index name prefix and the provided date rounding get formatted into a date math index name expression.
  777. Also here optionally date formatting can be specified on how the date should be formatted into a date math index name
  778. expression.
  779. An example pipeline that points documents to a monthly index that starts with a `myindex-` prefix based on a
  780. date in the `date1` field:
  781. [source,js]
  782. --------------------------------------------------
  783. PUT _ingest/pipeline/monthlyindex
  784. {
  785. "description": "monthly date-time index naming",
  786. "processors" : [
  787. {
  788. "date_index_name" : {
  789. "field" : "date1",
  790. "index_name_prefix" : "myindex-",
  791. "date_rounding" : "M"
  792. }
  793. }
  794. ]
  795. }
  796. --------------------------------------------------
  797. // CONSOLE
  798. Using that pipeline for an index request:
  799. [source,js]
  800. --------------------------------------------------
  801. PUT /myindex/_doc/1?pipeline=monthlyindex
  802. {
  803. "date1" : "2016-04-25T12:02:01.789Z"
  804. }
  805. --------------------------------------------------
  806. // CONSOLE
  807. // TEST[continued]
  808. [source,js]
  809. --------------------------------------------------
  810. {
  811. "_index" : "myindex-2016-04-01",
  812. "_type" : "_doc",
  813. "_id" : "1",
  814. "_version" : 1,
  815. "result" : "created",
  816. "_shards" : {
  817. "total" : 2,
  818. "successful" : 1,
  819. "failed" : 0
  820. },
  821. "_seq_no" : 0,
  822. "_primary_term" : 1
  823. }
  824. --------------------------------------------------
  825. // TESTRESPONSE
  826. The above request will not index this document into the `myindex` index, but into the `myindex-2016-04-01` index because
  827. it was rounded by month. This is because the date-index-name-processor overrides the `_index` property of the document.
  828. To see the date-math value of the index supplied in the actual index request which resulted in the above document being
  829. indexed into `myindex-2016-04-01` we can inspect the effects of the processor using a simulate request.
  830. [source,js]
  831. --------------------------------------------------
  832. POST _ingest/pipeline/_simulate
  833. {
  834. "pipeline" :
  835. {
  836. "description": "monthly date-time index naming",
  837. "processors" : [
  838. {
  839. "date_index_name" : {
  840. "field" : "date1",
  841. "index_name_prefix" : "myindex-",
  842. "date_rounding" : "M"
  843. }
  844. }
  845. ]
  846. },
  847. "docs": [
  848. {
  849. "_source": {
  850. "date1": "2016-04-25T12:02:01.789Z"
  851. }
  852. }
  853. ]
  854. }
  855. --------------------------------------------------
  856. // CONSOLE
  857. and the result:
  858. [source,js]
  859. --------------------------------------------------
  860. {
  861. "docs" : [
  862. {
  863. "doc" : {
  864. "_id" : "_id",
  865. "_index" : "<myindex-{2016-04-25||/M{yyyy-MM-dd|UTC}}>",
  866. "_type" : "_type",
  867. "_source" : {
  868. "date1" : "2016-04-25T12:02:01.789Z"
  869. },
  870. "_ingest" : {
  871. "timestamp" : "2016-11-08T19:43:03.850+0000"
  872. }
  873. }
  874. }
  875. ]
  876. }
  877. --------------------------------------------------
  878. // TESTRESPONSE[s/2016-11-08T19:43:03.850\+0000/$body.docs.0.doc._ingest.timestamp/]
  879. The above example shows that `_index` was set to `<myindex-{2016-04-25||/M{yyyy-MM-dd|UTC}}>`. Elasticsearch
  880. understands this to mean `2016-04-01` as is explained in the <<date-math-index-names, date math index name documentation>>
  881. [[date-index-name-options]]
  882. .Date index name options
  883. [options="header"]
  884. |======
  885. | Name | Required | Default | Description
  886. | `field` | yes | - | The field to get the date or timestamp from.
  887. | `index_name_prefix` | no | - | A prefix of the index name to be prepended before the printed date.
  888. | `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).
  889. | `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.
  890. | `timezone` | no | UTC | The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
  891. | `locale` | no | ENGLISH | The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
  892. | `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.
  893. |======
  894. [[fail-processor]]
  895. === Fail Processor
  896. Raises an exception. This is useful for when
  897. you expect a pipeline to fail and want to relay a specific message
  898. to the requester.
  899. [[fail-options]]
  900. .Fail Options
  901. [options="header"]
  902. |======
  903. | Name | Required | Default | Description
  904. | `message` | yes | - | The error message of the `FailException` thrown by the processor
  905. |======
  906. [source,js]
  907. --------------------------------------------------
  908. {
  909. "fail": {
  910. "message": "an error message"
  911. }
  912. }
  913. --------------------------------------------------
  914. // NOTCONSOLE
  915. [[foreach-processor]]
  916. === Foreach Processor
  917. Processes elements in an array of unknown length.
  918. All processors can operate on elements inside an array, but if all elements of an array need to
  919. be processed in the same way, defining a processor for each element becomes cumbersome and tricky
  920. because it is likely that the number of elements in an array is unknown. For this reason the `foreach`
  921. processor exists. By specifying the field holding array elements and a processor that
  922. defines what should happen to each element, array fields can easily be preprocessed.
  923. A processor inside the foreach processor works in the array element context and puts that in the ingest metadata
  924. under the `_ingest._value` key. If the array element is a json object it holds all immediate fields of that json object.
  925. and if the nested object is a value is `_ingest._value` just holds that value. Note that if a processor prior to the
  926. `foreach` processor used `_ingest._value` key then the specified value will not be available to the processor inside
  927. the `foreach` processor. The `foreach` processor does restore the original value, so that value is available to processors
  928. after the `foreach` processor.
  929. Note that any other field from the document are accessible and modifiable like with all other processors. This processor
  930. just puts the current array element being read into `_ingest._value` ingest metadata attribute, so that it may be
  931. pre-processed.
  932. If the `foreach` processor fails to process an element inside the array, and no `on_failure` processor has been specified,
  933. then it aborts the execution and leaves the array unmodified.
  934. [[foreach-options]]
  935. .Foreach Options
  936. [options="header"]
  937. |======
  938. | Name | Required | Default | Description
  939. | `field` | yes | - | The array field
  940. | `processor` | yes | - | The processor to execute against each field
  941. |======
  942. Assume the following document:
  943. [source,js]
  944. --------------------------------------------------
  945. {
  946. "values" : ["foo", "bar", "baz"]
  947. }
  948. --------------------------------------------------
  949. // NOTCONSOLE
  950. When this `foreach` processor operates on this sample document:
  951. [source,js]
  952. --------------------------------------------------
  953. {
  954. "foreach" : {
  955. "field" : "values",
  956. "processor" : {
  957. "uppercase" : {
  958. "field" : "_ingest._value"
  959. }
  960. }
  961. }
  962. }
  963. --------------------------------------------------
  964. // NOTCONSOLE
  965. Then the document will look like this after preprocessing:
  966. [source,js]
  967. --------------------------------------------------
  968. {
  969. "values" : ["FOO", "BAR", "BAZ"]
  970. }
  971. --------------------------------------------------
  972. // NOTCONSOLE
  973. Let's take a look at another example:
  974. [source,js]
  975. --------------------------------------------------
  976. {
  977. "persons" : [
  978. {
  979. "id" : "1",
  980. "name" : "John Doe"
  981. },
  982. {
  983. "id" : "2",
  984. "name" : "Jane Doe"
  985. }
  986. ]
  987. }
  988. --------------------------------------------------
  989. // NOTCONSOLE
  990. In this case, the `id` field needs to be removed,
  991. so the following `foreach` processor is used:
  992. [source,js]
  993. --------------------------------------------------
  994. {
  995. "foreach" : {
  996. "field" : "persons",
  997. "processor" : {
  998. "remove" : {
  999. "field" : "_ingest._value.id"
  1000. }
  1001. }
  1002. }
  1003. }
  1004. --------------------------------------------------
  1005. // NOTCONSOLE
  1006. After preprocessing the result is:
  1007. [source,js]
  1008. --------------------------------------------------
  1009. {
  1010. "persons" : [
  1011. {
  1012. "name" : "John Doe"
  1013. },
  1014. {
  1015. "name" : "Jane Doe"
  1016. }
  1017. ]
  1018. }
  1019. --------------------------------------------------
  1020. // NOTCONSOLE
  1021. The wrapped processor can have a `on_failure` definition.
  1022. For example, the `id` field may not exist on all person objects.
  1023. Instead of failing the index request, you can use an `on_failure`
  1024. block to send the document to the 'failure_index' index for later inspection:
  1025. [source,js]
  1026. --------------------------------------------------
  1027. {
  1028. "foreach" : {
  1029. "field" : "persons",
  1030. "processor" : {
  1031. "remove" : {
  1032. "field" : "_value.id",
  1033. "on_failure" : [
  1034. {
  1035. "set" : {
  1036. "field", "_index",
  1037. "value", "failure_index"
  1038. }
  1039. }
  1040. ]
  1041. }
  1042. }
  1043. }
  1044. }
  1045. --------------------------------------------------
  1046. // NOTCONSOLE
  1047. In this example, if the `remove` processor does fail, then
  1048. the array elements that have been processed thus far will
  1049. be updated.
  1050. Another advanced example can be found in the {plugins}/ingest-attachment-with-arrays.html[attachment processor documentation].
  1051. [[grok-processor]]
  1052. === Grok Processor
  1053. Extracts structured fields out of a single text field within a document. You choose which field to
  1054. extract matched fields from, as well as the grok pattern you expect will match. A grok pattern is like a regular
  1055. expression that supports aliased expressions that can be reused.
  1056. This tool is perfect for syslog logs, apache and other webserver logs, mysql logs, and in general, any log format
  1057. that is generally written for humans and not computer consumption.
  1058. This processor comes packaged with many
  1059. https://github.com/elastic/elasticsearch/blob/{branch}/libs/grok/src/main/resources/patterns[reusable patterns].
  1060. If you need help building patterns to match your logs, you will find the {kibana-ref}/xpack-grokdebugger.html[Grok Debugger] tool quite useful! The Grok Debugger is an {xpack} feature under the Basic License and is therefore *free to use*. The Grok Constructor at <http://grokconstructor.appspot.com/> is also a useful tool.
  1061. [[grok-basics]]
  1062. ==== Grok Basics
  1063. Grok sits on top of regular expressions, so any regular expressions are valid in grok as well.
  1064. The regular expression library is Oniguruma, and you can see the full supported regexp syntax
  1065. https://github.com/kkos/oniguruma/blob/master/doc/RE[on the Onigiruma site].
  1066. Grok works by leveraging this regular expression language to allow naming existing patterns and combining them into more
  1067. complex patterns that match your fields.
  1068. The syntax for reusing a grok pattern comes in three forms: `%{SYNTAX:SEMANTIC}`, `%{SYNTAX}`, `%{SYNTAX:SEMANTIC:TYPE}`.
  1069. The `SYNTAX` is the name of the pattern that will match your text. For example, `3.44` will be matched by the `NUMBER`
  1070. pattern and `55.3.244.1` will be matched by the `IP` pattern. The syntax is how you match. `NUMBER` and `IP` are both
  1071. patterns that are provided within the default patterns set.
  1072. The `SEMANTIC` is the identifier you give to the piece of text being matched. For example, `3.44` could be the
  1073. duration of an event, so you could call it simply `duration`. Further, a string `55.3.244.1` might identify
  1074. the `client` making a request.
  1075. The `TYPE` is the type you wish to cast your named field. `int`, `long`, `double`, `float` and `boolean` are supported types for coercion.
  1076. For example, you might want to match the following text:
  1077. [source,txt]
  1078. --------------------------------------------------
  1079. 3.44 55.3.244.1
  1080. --------------------------------------------------
  1081. You may know that the message in the example is a number followed by an IP address. You can match this text by using the following
  1082. Grok expression.
  1083. [source,txt]
  1084. --------------------------------------------------
  1085. %{NUMBER:duration} %{IP:client}
  1086. --------------------------------------------------
  1087. [[using-grok]]
  1088. ==== Using the Grok Processor in a Pipeline
  1089. [[grok-options]]
  1090. .Grok Options
  1091. [options="header"]
  1092. |======
  1093. | Name | Required | Default | Description
  1094. | `field` | yes | - | The field to use for grok expression parsing
  1095. | `patterns` | yes | - | An ordered list of grok expression to match and extract named captures with. Returns on the first expression in the list that matches.
  1096. | `pattern_definitions` | no | - | A map of pattern-name and pattern tuples defining custom patterns to be used by the current processor. Patterns matching existing names will override the pre-existing definition.
  1097. | `trace_match` | no | false | when true, `_ingest._grok_match_index` will be inserted into your matched document's metadata with the index into the pattern found in `patterns` that matched.
  1098. | `ignore_missing` | no | false | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1099. |======
  1100. Here is an example of using the provided patterns to extract out and name structured fields from a string field in
  1101. a document.
  1102. [source,js]
  1103. --------------------------------------------------
  1104. {
  1105. "message": "55.3.244.1 GET /index.html 15824 0.043"
  1106. }
  1107. --------------------------------------------------
  1108. // NOTCONSOLE
  1109. The pattern for this could be:
  1110. [source,txt]
  1111. --------------------------------------------------
  1112. %{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}
  1113. --------------------------------------------------
  1114. Here is an example pipeline for processing the above document by using Grok:
  1115. [source,js]
  1116. --------------------------------------------------
  1117. {
  1118. "description" : "...",
  1119. "processors": [
  1120. {
  1121. "grok": {
  1122. "field": "message",
  1123. "patterns": ["%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}"]
  1124. }
  1125. }
  1126. ]
  1127. }
  1128. --------------------------------------------------
  1129. // NOTCONSOLE
  1130. This pipeline will insert these named captures as new fields within the document, like so:
  1131. [source,js]
  1132. --------------------------------------------------
  1133. {
  1134. "message": "55.3.244.1 GET /index.html 15824 0.043",
  1135. "client": "55.3.244.1",
  1136. "method": "GET",
  1137. "request": "/index.html",
  1138. "bytes": 15824,
  1139. "duration": "0.043"
  1140. }
  1141. --------------------------------------------------
  1142. // NOTCONSOLE
  1143. [[custom-patterns]]
  1144. ==== Custom Patterns and Pattern Files
  1145. The Grok processor comes pre-packaged with a base set of pattern. These patterns may not always have
  1146. what you are looking for. Pattern have a very basic format. Each entry describes has a name and the pattern itself.
  1147. You can add your own patterns to a processor definition under the `pattern_definitions` option.
  1148. Here is an example of a pipeline specifying custom pattern definitions:
  1149. [source,js]
  1150. --------------------------------------------------
  1151. {
  1152. "description" : "...",
  1153. "processors": [
  1154. {
  1155. "grok": {
  1156. "field": "message",
  1157. "patterns": ["my %{FAVORITE_DOG:dog} is colored %{RGB:color}"],
  1158. "pattern_definitions" : {
  1159. "FAVORITE_DOG" : "beagle",
  1160. "RGB" : "RED|GREEN|BLUE"
  1161. }
  1162. }
  1163. }
  1164. ]
  1165. }
  1166. --------------------------------------------------
  1167. // NOTCONSOLE
  1168. [[trace-match]]
  1169. ==== Providing Multiple Match Patterns
  1170. Sometimes one pattern is not enough to capture the potential structure of a field. Let's assume we
  1171. want to match all messages that contain your favorite pet breeds of either cats or dogs. One way to accomplish
  1172. this is to provide two distinct patterns that can be matched, instead of one really complicated expression capturing
  1173. the same `or` behavior.
  1174. Here is an example of such a configuration executed against the simulate API:
  1175. [source,js]
  1176. --------------------------------------------------
  1177. POST _ingest/pipeline/_simulate
  1178. {
  1179. "pipeline": {
  1180. "description" : "parse multiple patterns",
  1181. "processors": [
  1182. {
  1183. "grok": {
  1184. "field": "message",
  1185. "patterns": ["%{FAVORITE_DOG:pet}", "%{FAVORITE_CAT:pet}"],
  1186. "pattern_definitions" : {
  1187. "FAVORITE_DOG" : "beagle",
  1188. "FAVORITE_CAT" : "burmese"
  1189. }
  1190. }
  1191. }
  1192. ]
  1193. },
  1194. "docs":[
  1195. {
  1196. "_source": {
  1197. "message": "I love burmese cats!"
  1198. }
  1199. }
  1200. ]
  1201. }
  1202. --------------------------------------------------
  1203. // CONSOLE
  1204. response:
  1205. [source,js]
  1206. --------------------------------------------------
  1207. {
  1208. "docs": [
  1209. {
  1210. "doc": {
  1211. "_type": "_type",
  1212. "_index": "_index",
  1213. "_id": "_id",
  1214. "_source": {
  1215. "message": "I love burmese cats!",
  1216. "pet": "burmese"
  1217. },
  1218. "_ingest": {
  1219. "timestamp": "2016-11-08T19:43:03.850+0000"
  1220. }
  1221. }
  1222. }
  1223. ]
  1224. }
  1225. --------------------------------------------------
  1226. // TESTRESPONSE[s/2016-11-08T19:43:03.850\+0000/$body.docs.0.doc._ingest.timestamp/]
  1227. Both patterns will set the field `pet` with the appropriate match, but what if we want to trace which of our
  1228. patterns matched and populated our fields? We can do this with the `trace_match` parameter. Here is the output of
  1229. that same pipeline, but with `"trace_match": true` configured:
  1230. ////
  1231. Hidden setup for example:
  1232. [source,js]
  1233. --------------------------------------------------
  1234. POST _ingest/pipeline/_simulate
  1235. {
  1236. "pipeline": {
  1237. "description" : "parse multiple patterns",
  1238. "processors": [
  1239. {
  1240. "grok": {
  1241. "field": "message",
  1242. "patterns": ["%{FAVORITE_DOG:pet}", "%{FAVORITE_CAT:pet}"],
  1243. "trace_match": true,
  1244. "pattern_definitions" : {
  1245. "FAVORITE_DOG" : "beagle",
  1246. "FAVORITE_CAT" : "burmese"
  1247. }
  1248. }
  1249. }
  1250. ]
  1251. },
  1252. "docs":[
  1253. {
  1254. "_source": {
  1255. "message": "I love burmese cats!"
  1256. }
  1257. }
  1258. ]
  1259. }
  1260. --------------------------------------------------
  1261. // CONSOLE
  1262. ////
  1263. [source,js]
  1264. --------------------------------------------------
  1265. {
  1266. "docs": [
  1267. {
  1268. "doc": {
  1269. "_type": "_type",
  1270. "_index": "_index",
  1271. "_id": "_id",
  1272. "_source": {
  1273. "message": "I love burmese cats!",
  1274. "pet": "burmese"
  1275. },
  1276. "_ingest": {
  1277. "_grok_match_index": "1",
  1278. "timestamp": "2016-11-08T19:43:03.850+0000"
  1279. }
  1280. }
  1281. }
  1282. ]
  1283. }
  1284. --------------------------------------------------
  1285. // TESTRESPONSE[s/2016-11-08T19:43:03.850\+0000/$body.docs.0.doc._ingest.timestamp/]
  1286. In the above response, you can see that the index of the pattern that matched was `"1"`. This is to say that it was the
  1287. second (index starts at zero) pattern in `patterns` to match.
  1288. This trace metadata enables debugging which of the patterns matched. This information is stored in the ingest
  1289. metadata and will not be indexed.
  1290. [[grok-processor-rest-get]]
  1291. ==== Retrieving patterns from REST endpoint
  1292. The Grok Processor comes packaged with its own REST endpoint for retrieving which patterns the processor is packaged with.
  1293. [source,js]
  1294. --------------------------------------------------
  1295. GET _ingest/processor/grok
  1296. --------------------------------------------------
  1297. // CONSOLE
  1298. The above request will return a response body containing a key-value representation of the built-in patterns dictionary.
  1299. [source,js]
  1300. --------------------------------------------------
  1301. {
  1302. "patterns" : {
  1303. "BACULA_CAPACITY" : "%{INT}{1,3}(,%{INT}{3})*",
  1304. "PATH" : "(?:%{UNIXPATH}|%{WINPATH})",
  1305. ...
  1306. }
  1307. --------------------------------------------------
  1308. // NOTCONSOLE
  1309. This can be useful to reference as the built-in patterns change across versions.
  1310. [[gsub-processor]]
  1311. === Gsub Processor
  1312. Converts a string field by applying a regular expression and a replacement.
  1313. If the field is not a string, the processor will throw an exception.
  1314. [[gsub-options]]
  1315. .Gsub Options
  1316. [options="header"]
  1317. |======
  1318. | Name | Required | Default | Description
  1319. | `field` | yes | - | The field to apply the replacement to
  1320. | `pattern` | yes | - | The pattern to be replaced
  1321. | `replacement` | yes | - | The string to replace the matching patterns with
  1322. | `target_field` | no | `field` | The field to assign the converted value to, by default `field` is updated in-place
  1323. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1324. |======
  1325. [source,js]
  1326. --------------------------------------------------
  1327. {
  1328. "gsub": {
  1329. "field": "field1",
  1330. "pattern": "\.",
  1331. "replacement": "-"
  1332. }
  1333. }
  1334. --------------------------------------------------
  1335. // NOTCONSOLE
  1336. [[join-processor]]
  1337. === Join Processor
  1338. Joins each element of an array into a single string using a separator character between each element.
  1339. Throws an error when the field is not an array.
  1340. [[join-options]]
  1341. .Join Options
  1342. [options="header"]
  1343. |======
  1344. | Name | Required | Default | Description
  1345. | `field` | yes | - | The field to be separated
  1346. | `separator` | yes | - | The separator character
  1347. | `target_field` | no | `field` | The field to assign the joined value to, by default `field` is updated in-place
  1348. |======
  1349. [source,js]
  1350. --------------------------------------------------
  1351. {
  1352. "join": {
  1353. "field": "joined_array_field",
  1354. "separator": "-"
  1355. }
  1356. }
  1357. --------------------------------------------------
  1358. // NOTCONSOLE
  1359. [[json-processor]]
  1360. === JSON Processor
  1361. Converts a JSON string into a structured JSON object.
  1362. [[json-options]]
  1363. .Json Options
  1364. [options="header"]
  1365. |======
  1366. | Name | Required | Default | Description
  1367. | `field` | yes | - | The field to be parsed
  1368. | `target_field` | no | `field` | The field to insert the converted structured object into
  1369. | `add_to_root` | no | false | Flag that forces the serialized json to be injected into the top level of the document. `target_field` must not be set when this option is chosen.
  1370. |======
  1371. All JSON-supported types will be parsed (null, boolean, number, array, object, string).
  1372. Suppose you provide this configuration of the `json` processor:
  1373. [source,js]
  1374. --------------------------------------------------
  1375. {
  1376. "json" : {
  1377. "field" : "string_source",
  1378. "target_field" : "json_target"
  1379. }
  1380. }
  1381. --------------------------------------------------
  1382. // NOTCONSOLE
  1383. If the following document is processed:
  1384. [source,js]
  1385. --------------------------------------------------
  1386. {
  1387. "string_source": "{\"foo\": 2000}"
  1388. }
  1389. --------------------------------------------------
  1390. // NOTCONSOLE
  1391. after the `json` processor operates on it, it will look like:
  1392. [source,js]
  1393. --------------------------------------------------
  1394. {
  1395. "string_source": "{\"foo\": 2000}",
  1396. "json_target": {
  1397. "foo": 2000
  1398. }
  1399. }
  1400. --------------------------------------------------
  1401. // NOTCONSOLE
  1402. If the following configuration is provided, omitting the optional `target_field` setting:
  1403. [source,js]
  1404. --------------------------------------------------
  1405. {
  1406. "json" : {
  1407. "field" : "source_and_target"
  1408. }
  1409. }
  1410. --------------------------------------------------
  1411. // NOTCONSOLE
  1412. then after the `json` processor operates on this document:
  1413. [source,js]
  1414. --------------------------------------------------
  1415. {
  1416. "source_and_target": "{\"foo\": 2000}"
  1417. }
  1418. --------------------------------------------------
  1419. // NOTCONSOLE
  1420. it will look like:
  1421. [source,js]
  1422. --------------------------------------------------
  1423. {
  1424. "source_and_target": {
  1425. "foo": 2000
  1426. }
  1427. }
  1428. --------------------------------------------------
  1429. // NOTCONSOLE
  1430. This illustrates that, unless it is explicitly named in the processor configuration, the `target_field`
  1431. is the same field provided in the required `field` configuration.
  1432. [[kv-processor]]
  1433. === KV Processor
  1434. This processor helps automatically parse messages (or specific event fields) which are of the foo=bar variety.
  1435. For example, if you have a log message which contains `ip=1.2.3.4 error=REFUSED`, you can parse those automatically by configuring:
  1436. [source,js]
  1437. --------------------------------------------------
  1438. {
  1439. "kv": {
  1440. "field": "message",
  1441. "field_split": " ",
  1442. "value_split": "="
  1443. }
  1444. }
  1445. --------------------------------------------------
  1446. // NOTCONSOLE
  1447. [[kv-options]]
  1448. .Kv Options
  1449. [options="header"]
  1450. |======
  1451. | Name | Required | Default | Description
  1452. | `field` | yes | - | The field to be parsed
  1453. | `field_split` | yes | - | Regex pattern to use for splitting key-value pairs
  1454. | `value_split` | yes | - | Regex pattern to use for splitting the key from the value within a key-value pair
  1455. | `target_field` | no | `null` | The field to insert the extracted keys into. Defaults to the root of the document
  1456. | `include_keys` | no | `null` | List of keys to filter and insert into document. Defaults to including all keys
  1457. | `exclude_keys` | no | `null` | List of keys to exclude from document
  1458. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1459. |======
  1460. [[lowercase-processor]]
  1461. === Lowercase Processor
  1462. Converts a string to its lowercase equivalent.
  1463. [[lowercase-options]]
  1464. .Lowercase Options
  1465. [options="header"]
  1466. |======
  1467. | Name | Required | Default | Description
  1468. | `field` | yes | - | The field to make lowercase
  1469. | `target_field` | no | `field` | The field to assign the converted value to, by default `field` is updated in-place
  1470. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1471. |======
  1472. [source,js]
  1473. --------------------------------------------------
  1474. {
  1475. "lowercase": {
  1476. "field": "foo"
  1477. }
  1478. }
  1479. --------------------------------------------------
  1480. // NOTCONSOLE
  1481. [[remove-processor]]
  1482. === Remove Processor
  1483. Removes existing fields. If one field doesn't exist, an exception will be thrown.
  1484. [[remove-options]]
  1485. .Remove Options
  1486. [options="header"]
  1487. |======
  1488. | Name | Required | Default | Description
  1489. | `field` | yes | - | Fields to be removed
  1490. |======
  1491. Here is an example to remove a single field:
  1492. [source,js]
  1493. --------------------------------------------------
  1494. {
  1495. "remove": {
  1496. "field": "foo"
  1497. }
  1498. }
  1499. --------------------------------------------------
  1500. // NOTCONSOLE
  1501. To remove multiple fields, you can use the following query:
  1502. [source,js]
  1503. --------------------------------------------------
  1504. {
  1505. "remove": {
  1506. "field": ["foo", "bar"]
  1507. }
  1508. }
  1509. --------------------------------------------------
  1510. // NOTCONSOLE
  1511. [[rename-processor]]
  1512. === Rename Processor
  1513. Renames an existing field. If the field doesn't exist or the new name is already used, an exception will be thrown.
  1514. [[rename-options]]
  1515. .Rename Options
  1516. [options="header"]
  1517. |======
  1518. | Name | Required | Default | Description
  1519. | `field` | yes | - | The field to be renamed
  1520. | `target_field` | yes | - | The new name of the field
  1521. | `ignore_missing` | no | `false` | If `true` and `field` does not exist, the processor quietly exits without modifying the document
  1522. |======
  1523. [source,js]
  1524. --------------------------------------------------
  1525. {
  1526. "rename": {
  1527. "field": "foo",
  1528. "target_field": "foobar"
  1529. }
  1530. }
  1531. --------------------------------------------------
  1532. // NOTCONSOLE
  1533. [[script-processor]]
  1534. === Script Processor
  1535. Allows inline and stored scripts to be executed within ingest pipelines.
  1536. See <<modules-scripting-using, How to use scripts>> to learn more about writing scripts. The Script Processor
  1537. leverages caching of compiled scripts for improved performance. Since the
  1538. script specified within the processor is potentially re-compiled per document, it is important
  1539. to understand how script caching works. To learn more about
  1540. caching see <<modules-scripting-using-caching, Script Caching>>.
  1541. [[script-options]]
  1542. .Script Options
  1543. [options="header"]
  1544. |======
  1545. | Name | Required | Default | Description
  1546. | `lang` | no | "painless" | The scripting language
  1547. | `id` | no | - | The stored script id to refer to
  1548. | `source` | no | - | An inline script to be executed
  1549. | `params` | no | - | Script Parameters
  1550. |======
  1551. One of `id` or `source` options must be provided in order to properly reference a script to execute.
  1552. You can access the current ingest document from within the script context by using the `ctx` variable.
  1553. The following example sets a new field called `field_a_plus_b_times_c` to be the sum of two existing
  1554. numeric fields `field_a` and `field_b` multiplied by the parameter param_c:
  1555. [source,js]
  1556. --------------------------------------------------
  1557. {
  1558. "script": {
  1559. "lang": "painless",
  1560. "source": "ctx.field_a_plus_b_times_c = (ctx.field_a + ctx.field_b) * params.param_c",
  1561. "params": {
  1562. "param_c": 10
  1563. }
  1564. }
  1565. }
  1566. --------------------------------------------------
  1567. // NOTCONSOLE
  1568. It is possible to use the Script Processor to manipulate document metadata like `_index` and `_type` during
  1569. ingestion. Here is an example of an Ingest Pipeline that renames the index and type to `my_index` no matter what
  1570. was provided in the original index request:
  1571. [source,js]
  1572. --------------------------------------------------
  1573. PUT _ingest/pipeline/my_index
  1574. {
  1575. "description": "use index:my_index and type:_doc",
  1576. "processors": [
  1577. {
  1578. "script": {
  1579. "source": """
  1580. ctx._index = 'my_index';
  1581. ctx._type = '_doc';
  1582. """
  1583. }
  1584. }
  1585. ]
  1586. }
  1587. --------------------------------------------------
  1588. // CONSOLE
  1589. Using the above pipeline, we can attempt to index a document into the `any_index` index.
  1590. [source,js]
  1591. --------------------------------------------------
  1592. PUT any_index/_doc/1?pipeline=my_index
  1593. {
  1594. "message": "text"
  1595. }
  1596. --------------------------------------------------
  1597. // CONSOLE
  1598. // TEST[continued]
  1599. The response from the above index request:
  1600. [source,js]
  1601. --------------------------------------------------
  1602. {
  1603. "_index": "my_index",
  1604. "_type": "_doc",
  1605. "_id": "1",
  1606. "_version": 1,
  1607. "result": "created",
  1608. "_shards": {
  1609. "total": 2,
  1610. "successful": 1,
  1611. "failed": 0
  1612. },
  1613. "_seq_no": 0,
  1614. "_primary_term": 1,
  1615. }
  1616. --------------------------------------------------
  1617. // TESTRESPONSE
  1618. In the above response, you can see that our document was actually indexed into `my_index` instead of
  1619. `any_index`. This type of manipulation is often convenient in pipelines that have various branches of transformation,
  1620. and depending on the progress made, indexed into different indices.
  1621. [[set-processor]]
  1622. === Set Processor
  1623. Sets one field and associates it with the specified value. If the field already exists,
  1624. its value will be replaced with the provided one.
  1625. [[set-options]]
  1626. .Set Options
  1627. [options="header"]
  1628. |======
  1629. | Name | Required | Default | Description
  1630. | `field` | yes | - | The field to insert, upsert, or update
  1631. | `value` | yes | - | The value to be set for the field
  1632. | `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.
  1633. |======
  1634. [source,js]
  1635. --------------------------------------------------
  1636. {
  1637. "set": {
  1638. "field": "field1",
  1639. "value": 582.1
  1640. }
  1641. }
  1642. --------------------------------------------------
  1643. // NOTCONSOLE
  1644. [[split-processor]]
  1645. === Split Processor
  1646. Splits a field into an array using a separator character. Only works on string fields.
  1647. [[split-options]]
  1648. .Split Options
  1649. [options="header"]
  1650. |======
  1651. | Name | Required | Default | Description
  1652. | `field` | yes | - | The field to split
  1653. | `separator` | yes | - | A regex which matches the separator, eg `,` or `\s+`
  1654. | `target_field` | no | `field` | The field to assign the split value to, by default `field` is updated in-place
  1655. | `ignore_missing` | no | `false` | If `true` and `field` does not exist, the processor quietly exits without modifying the document
  1656. |======
  1657. [source,js]
  1658. --------------------------------------------------
  1659. {
  1660. "split": {
  1661. "field": "my_field",
  1662. "separator": "\\s+" <1>
  1663. }
  1664. }
  1665. --------------------------------------------------
  1666. // NOTCONSOLE
  1667. <1> Treat all consecutive whitespace characters as a single separator
  1668. [[sort-processor]]
  1669. === Sort Processor
  1670. Sorts the elements of an array ascending or descending. Homogeneous arrays of numbers will be sorted
  1671. numerically, while arrays of strings or heterogeneous arrays of strings + numbers will be sorted lexicographically.
  1672. Throws an error when the field is not an array.
  1673. [[sort-options]]
  1674. .Sort Options
  1675. [options="header"]
  1676. |======
  1677. | Name | Required | Default | Description
  1678. | `field` | yes | - | The field to be sorted
  1679. | `order` | no | `"asc"` | The sort order to use. Accepts `"asc"` or `"desc"`.
  1680. | `target_field` | no | `field` | The field to assign the sorted value to, by default `field` is updated in-place
  1681. |======
  1682. [source,js]
  1683. --------------------------------------------------
  1684. {
  1685. "sort": {
  1686. "field": "field_to_sort",
  1687. "order": "desc"
  1688. }
  1689. }
  1690. --------------------------------------------------
  1691. // NOTCONSOLE
  1692. [[trim-processor]]
  1693. === Trim Processor
  1694. Trims whitespace from field.
  1695. NOTE: This only works on leading and trailing whitespace.
  1696. [[trim-options]]
  1697. .Trim Options
  1698. [options="header"]
  1699. |======
  1700. | Name | Required | Default | Description
  1701. | `field` | yes | - | The string-valued field to trim whitespace from
  1702. | `target_field` | no | `field` | The field to assign the trimmed value to, by default `field` is updated in-place
  1703. | `ignore_missing` | no | `false` | If `true` and `field` does not exist, the processor quietly exits without modifying the document
  1704. |======
  1705. [source,js]
  1706. --------------------------------------------------
  1707. {
  1708. "trim": {
  1709. "field": "foo"
  1710. }
  1711. }
  1712. --------------------------------------------------
  1713. // NOTCONSOLE
  1714. [[uppercase-processor]]
  1715. === Uppercase Processor
  1716. Converts a string to its uppercase equivalent.
  1717. [[uppercase-options]]
  1718. .Uppercase Options
  1719. [options="header"]
  1720. |======
  1721. | Name | Required | Default | Description
  1722. | `field` | yes | - | The field to make uppercase
  1723. | `target_field` | no | `field` | The field to assign the converted value to, by default `field` is updated in-place
  1724. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1725. |======
  1726. [source,js]
  1727. --------------------------------------------------
  1728. {
  1729. "uppercase": {
  1730. "field": "foo"
  1731. }
  1732. }
  1733. --------------------------------------------------
  1734. // NOTCONSOLE
  1735. [[dot-expand-processor]]
  1736. === Dot Expander Processor
  1737. Expands a field with dots into an object field. This processor allows fields
  1738. with dots in the name to be accessible by other processors in the pipeline.
  1739. Otherwise these <<accessing-data-in-pipelines,fields>> can't be accessed by any processor.
  1740. [[dot-expender-options]]
  1741. .Dot Expand Options
  1742. [options="header"]
  1743. |======
  1744. | Name | Required | Default | Description
  1745. | `field` | yes | - | The field to expand into an object field
  1746. | `path` | no | - | The field that contains the field to expand. Only required if the field to expand is part another object field, because the `field` option can only understand leaf fields.
  1747. |======
  1748. [source,js]
  1749. --------------------------------------------------
  1750. {
  1751. "dot_expander": {
  1752. "field": "foo.bar"
  1753. }
  1754. }
  1755. --------------------------------------------------
  1756. // NOTCONSOLE
  1757. For example the dot expand processor would turn this document:
  1758. [source,js]
  1759. --------------------------------------------------
  1760. {
  1761. "foo.bar" : "value"
  1762. }
  1763. --------------------------------------------------
  1764. // NOTCONSOLE
  1765. into:
  1766. [source,js]
  1767. --------------------------------------------------
  1768. {
  1769. "foo" : {
  1770. "bar" : "value"
  1771. }
  1772. }
  1773. --------------------------------------------------
  1774. // NOTCONSOLE
  1775. If there is already a `bar` field nested under `foo` then
  1776. this processor merges the `foo.bar` field into it. If the field is
  1777. a scalar value then it will turn that field into an array field.
  1778. For example, the following document:
  1779. [source,js]
  1780. --------------------------------------------------
  1781. {
  1782. "foo.bar" : "value2",
  1783. "foo" : {
  1784. "bar" : "value1"
  1785. }
  1786. }
  1787. --------------------------------------------------
  1788. // NOTCONSOLE
  1789. is transformed by the `dot_expander` processor into:
  1790. [source,js]
  1791. --------------------------------------------------
  1792. {
  1793. "foo" : {
  1794. "bar" : ["value1", "value2"]
  1795. }
  1796. }
  1797. --------------------------------------------------
  1798. // NOTCONSOLE
  1799. If any field outside of the leaf field conflicts with a pre-existing field of the same name,
  1800. then that field needs to be renamed first.
  1801. Consider the following document:
  1802. [source,js]
  1803. --------------------------------------------------
  1804. {
  1805. "foo": "value1",
  1806. "foo.bar": "value2"
  1807. }
  1808. --------------------------------------------------
  1809. // NOTCONSOLE
  1810. Then the `foo` needs to be renamed first before the `dot_expander`
  1811. processor is applied. So in order for the `foo.bar` field to properly
  1812. be expanded into the `bar` field under the `foo` field the following
  1813. pipeline should be used:
  1814. [source,js]
  1815. --------------------------------------------------
  1816. {
  1817. "processors" : [
  1818. {
  1819. "rename" : {
  1820. "field" : "foo",
  1821. "target_field" : "foo.bar""
  1822. }
  1823. },
  1824. {
  1825. "dot_expander": {
  1826. "field": "foo.bar"
  1827. }
  1828. }
  1829. ]
  1830. }
  1831. --------------------------------------------------
  1832. // NOTCONSOLE
  1833. The reason for this is that Ingest doesn't know how to automatically cast
  1834. a scalar field to an object field.
  1835. [[urldecode-processor]]
  1836. === URL Decode Processor
  1837. URL-decodes a string
  1838. [[urldecode-options]]
  1839. .URL Decode Options
  1840. [options="header"]
  1841. |======
  1842. | Name | Required | Default | Description
  1843. | `field` | yes | - | The field to decode
  1844. | `target_field` | no | `field` | The field to assign the converted value to, by default `field` is updated in-place
  1845. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1846. |======
  1847. [source,js]
  1848. --------------------------------------------------
  1849. {
  1850. "urldecode": {
  1851. "field": "my_url_to_decode"
  1852. }
  1853. }
  1854. --------------------------------------------------
  1855. // NOTCONSOLE