ingest-node.asciidoc 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145
  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": "type",
  214. "_id": "id",
  215. "_source": {
  216. "foo": "bar"
  217. }
  218. },
  219. {
  220. "_index": "index",
  221. "_type": "type",
  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": "type",
  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": "type",
  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": "type",
  302. "_id": "id",
  303. "_source": {
  304. "foo": "bar"
  305. }
  306. },
  307. {
  308. "_index": "index",
  309. "_type": "type",
  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": "type",
  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": "type",
  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": "type",
  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": "type",
  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`, `float`, `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`. And
  686. a value of `"242.15"` will "automatically" be converted to `242.15` of type `float`. If a provided field cannot
  687. be appropriately converted, the Convert Processor will still process successfully and leave the field value as-is. In
  688. such a case, `target_field` will still be updated with the unconverted field value.
  689. [[convert-options]]
  690. .Convert Options
  691. [options="header"]
  692. |======
  693. | Name | Required | Default | Description
  694. | `field` | yes | - | The field whose value is to be converted
  695. | `target_field` | no | `field` | The field to assign the converted value to, by default `field` is updated in-place
  696. | `type` | yes | - | The type to convert the existing value to
  697. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  698. |======
  699. [source,js]
  700. --------------------------------------------------
  701. {
  702. "convert": {
  703. "field" : "foo",
  704. "type": "integer"
  705. }
  706. }
  707. --------------------------------------------------
  708. // NOTCONSOLE
  709. [[date-processor]]
  710. === Date Processor
  711. Parses dates from fields, and then uses the date or timestamp as the timestamp for the document.
  712. By default, the date processor adds the parsed date as a new field called `@timestamp`. You can specify a
  713. different field by setting the `target_field` configuration parameter. Multiple date formats are supported
  714. as part of the same date processor definition. They will be used sequentially to attempt parsing the date field,
  715. in the same order they were defined as part of the processor definition.
  716. [[date-options]]
  717. .Date options
  718. [options="header"]
  719. |======
  720. | Name | Required | Default | Description
  721. | `field` | yes | - | The field to get the date from.
  722. | `target_field` | no | @timestamp | The field that will hold the parsed date.
  723. | `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.
  724. | `timezone` | no | UTC | The timezone to use when parsing the date.
  725. | `locale` | no | ENGLISH | The locale to use when parsing the date, relevant when parsing month names or week days.
  726. |======
  727. Here is an example that adds the parsed date to the `timestamp` field based on the `initial_date` field:
  728. [source,js]
  729. --------------------------------------------------
  730. {
  731. "description" : "...",
  732. "processors" : [
  733. {
  734. "date" : {
  735. "field" : "initial_date",
  736. "target_field" : "timestamp",
  737. "formats" : ["dd/MM/yyyy hh:mm:ss"],
  738. "timezone" : "Europe/Amsterdam"
  739. }
  740. }
  741. ]
  742. }
  743. --------------------------------------------------
  744. // NOTCONSOLE
  745. The `timezone` and `locale` processor parameters are templated. This means that their values can be
  746. extracted from fields within documents. The example below shows how to extract the locale/timezone
  747. details from existing fields, `my_timezone` and `my_locale`, in the ingested document that contain
  748. the timezone and locale values.
  749. [source,js]
  750. --------------------------------------------------
  751. {
  752. "description" : "...",
  753. "processors" : [
  754. {
  755. "date" : {
  756. "field" : "initial_date",
  757. "target_field" : "timestamp",
  758. "formats" : ["ISO8601"],
  759. "timezone" : "{{ my_timezone }}",
  760. "locale" : "{{ my_locale }}"
  761. }
  762. }
  763. ]
  764. }
  765. --------------------------------------------------
  766. // NOTCONSOLE
  767. [[date-index-name-processor]]
  768. === Date Index Name Processor
  769. The purpose of this processor is to point documents to the right time based index based
  770. on a date or timestamp field in a document by using the <<date-math-index-names, date math index name support>>.
  771. The processor sets the `_index` meta field with a date math index name expression based on the provided index name
  772. prefix, a date or timestamp field in the documents being processed and the provided date rounding.
  773. First, this processor fetches the date or timestamp from a field in the document being processed. Optionally,
  774. date formatting can be configured on how the field's value should be parsed into a date. Then this date,
  775. the provided index name prefix and the provided date rounding get formatted into a date math index name expression.
  776. Also here optionally date formatting can be specified on how the date should be formatted into a date math index name
  777. expression.
  778. An example pipeline that points documents to a monthly index that starts with a `myindex-` prefix based on a
  779. date in the `date1` field:
  780. [source,js]
  781. --------------------------------------------------
  782. PUT _ingest/pipeline/monthlyindex
  783. {
  784. "description": "monthly date-time index naming",
  785. "processors" : [
  786. {
  787. "date_index_name" : {
  788. "field" : "date1",
  789. "index_name_prefix" : "myindex-",
  790. "date_rounding" : "M"
  791. }
  792. }
  793. ]
  794. }
  795. --------------------------------------------------
  796. // CONSOLE
  797. Using that pipeline for an index request:
  798. [source,js]
  799. --------------------------------------------------
  800. PUT /myindex/type/1?pipeline=monthlyindex
  801. {
  802. "date1" : "2016-04-25T12:02:01.789Z"
  803. }
  804. --------------------------------------------------
  805. // CONSOLE
  806. // TEST[continued]
  807. [source,js]
  808. --------------------------------------------------
  809. {
  810. "_index" : "myindex-2016-04-01",
  811. "_type" : "type",
  812. "_id" : "1",
  813. "_version" : 1,
  814. "result" : "created",
  815. "_shards" : {
  816. "total" : 2,
  817. "successful" : 1,
  818. "failed" : 0
  819. },
  820. "_seq_no" : 0,
  821. "_primary_term" : 1
  822. }
  823. --------------------------------------------------
  824. // TESTRESPONSE
  825. The above request will not index this document into the `myindex` index, but into the `myindex-2016-04-01` index because
  826. it was rounded by month. This is because the date-index-name-processor overrides the `_index` property of the document.
  827. To see the date-math value of the index supplied in the actual index request which resulted in the above document being
  828. indexed into `myindex-2016-04-01` we can inspect the effects of the processor using a simulate request.
  829. [source,js]
  830. --------------------------------------------------
  831. POST _ingest/pipeline/_simulate
  832. {
  833. "pipeline" :
  834. {
  835. "description": "monthly date-time index naming",
  836. "processors" : [
  837. {
  838. "date_index_name" : {
  839. "field" : "date1",
  840. "index_name_prefix" : "myindex-",
  841. "date_rounding" : "M"
  842. }
  843. }
  844. ]
  845. },
  846. "docs": [
  847. {
  848. "_source": {
  849. "date1": "2016-04-25T12:02:01.789Z"
  850. }
  851. }
  852. ]
  853. }
  854. --------------------------------------------------
  855. // CONSOLE
  856. and the result:
  857. [source,js]
  858. --------------------------------------------------
  859. {
  860. "docs" : [
  861. {
  862. "doc" : {
  863. "_id" : "_id",
  864. "_index" : "<myindex-{2016-04-25||/M{yyyy-MM-dd|UTC}}>",
  865. "_type" : "_type",
  866. "_source" : {
  867. "date1" : "2016-04-25T12:02:01.789Z"
  868. },
  869. "_ingest" : {
  870. "timestamp" : "2016-11-08T19:43:03.850+0000"
  871. }
  872. }
  873. }
  874. ]
  875. }
  876. --------------------------------------------------
  877. // TESTRESPONSE[s/2016-11-08T19:43:03.850\+0000/$body.docs.0.doc._ingest.timestamp/]
  878. The above example shows that `_index` was set to `<myindex-{2016-04-25||/M{yyyy-MM-dd|UTC}}>`. Elasticsearch
  879. understands this to mean `2016-04-01` as is explained in the <<date-math-index-names, date math index name documentation>>
  880. [[date-index-name-options]]
  881. .Date index name options
  882. [options="header"]
  883. |======
  884. | Name | Required | Default | Description
  885. | `field` | yes | - | The field to get the date or timestamp from.
  886. | `index_name_prefix` | no | - | A prefix of the index name to be prepended before the printed date.
  887. | `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).
  888. | `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.
  889. | `timezone` | no | UTC | The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names.
  890. | `locale` | no | ENGLISH | The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days.
  891. | `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.
  892. |======
  893. [[fail-processor]]
  894. === Fail Processor
  895. Raises an exception. This is useful for when
  896. you expect a pipeline to fail and want to relay a specific message
  897. to the requester.
  898. [[fail-options]]
  899. .Fail Options
  900. [options="header"]
  901. |======
  902. | Name | Required | Default | Description
  903. | `message` | yes | - | The error message of the `FailException` thrown by the processor
  904. |======
  905. [source,js]
  906. --------------------------------------------------
  907. {
  908. "fail": {
  909. "message": "an error message"
  910. }
  911. }
  912. --------------------------------------------------
  913. // NOTCONSOLE
  914. [[foreach-processor]]
  915. === Foreach Processor
  916. Processes elements in an array of unknown length.
  917. All processors can operate on elements inside an array, but if all elements of an array need to
  918. be processed in the same way, defining a processor for each element becomes cumbersome and tricky
  919. because it is likely that the number of elements in an array is unknown. For this reason the `foreach`
  920. processor exists. By specifying the field holding array elements and a processor that
  921. defines what should happen to each element, array fields can easily be preprocessed.
  922. A processor inside the foreach processor works in the array element context and puts that in the ingest metadata
  923. under the `_ingest._value` key. If the array element is a json object it holds all immediate fields of that json object.
  924. and if the nested object is a value is `_ingest._value` just holds that value. Note that if a processor prior to the
  925. `foreach` processor used `_ingest._value` key then the specified value will not be available to the processor inside
  926. the `foreach` processor. The `foreach` processor does restore the original value, so that value is available to processors
  927. after the `foreach` processor.
  928. Note that any other field from the document are accessible and modifiable like with all other processors. This processor
  929. just puts the current array element being read into `_ingest._value` ingest metadata attribute, so that it may be
  930. pre-processed.
  931. If the `foreach` processor fails to process an element inside the array, and no `on_failure` processor has been specified,
  932. then it aborts the execution and leaves the array unmodified.
  933. [[foreach-options]]
  934. .Foreach Options
  935. [options="header"]
  936. |======
  937. | Name | Required | Default | Description
  938. | `field` | yes | - | The array field
  939. | `processor` | yes | - | The processor to execute against each field
  940. |======
  941. Assume the following document:
  942. [source,js]
  943. --------------------------------------------------
  944. {
  945. "values" : ["foo", "bar", "baz"]
  946. }
  947. --------------------------------------------------
  948. // NOTCONSOLE
  949. When this `foreach` processor operates on this sample document:
  950. [source,js]
  951. --------------------------------------------------
  952. {
  953. "foreach" : {
  954. "field" : "values",
  955. "processor" : {
  956. "uppercase" : {
  957. "field" : "_ingest._value"
  958. }
  959. }
  960. }
  961. }
  962. --------------------------------------------------
  963. // NOTCONSOLE
  964. Then the document will look like this after preprocessing:
  965. [source,js]
  966. --------------------------------------------------
  967. {
  968. "values" : ["FOO", "BAR", "BAZ"]
  969. }
  970. --------------------------------------------------
  971. // NOTCONSOLE
  972. Let's take a look at another example:
  973. [source,js]
  974. --------------------------------------------------
  975. {
  976. "persons" : [
  977. {
  978. "id" : "1",
  979. "name" : "John Doe"
  980. },
  981. {
  982. "id" : "2",
  983. "name" : "Jane Doe"
  984. }
  985. ]
  986. }
  987. --------------------------------------------------
  988. // NOTCONSOLE
  989. In this case, the `id` field needs to be removed,
  990. so the following `foreach` processor is used:
  991. [source,js]
  992. --------------------------------------------------
  993. {
  994. "foreach" : {
  995. "field" : "persons",
  996. "processor" : {
  997. "remove" : {
  998. "field" : "_ingest._value.id"
  999. }
  1000. }
  1001. }
  1002. }
  1003. --------------------------------------------------
  1004. // NOTCONSOLE
  1005. After preprocessing the result is:
  1006. [source,js]
  1007. --------------------------------------------------
  1008. {
  1009. "persons" : [
  1010. {
  1011. "name" : "John Doe"
  1012. },
  1013. {
  1014. "name" : "Jane Doe"
  1015. }
  1016. ]
  1017. }
  1018. --------------------------------------------------
  1019. // NOTCONSOLE
  1020. The wrapped processor can have a `on_failure` definition.
  1021. For example, the `id` field may not exist on all person objects.
  1022. Instead of failing the index request, you can use an `on_failure`
  1023. block to send the document to the 'failure_index' index for later inspection:
  1024. [source,js]
  1025. --------------------------------------------------
  1026. {
  1027. "foreach" : {
  1028. "field" : "persons",
  1029. "processor" : {
  1030. "remove" : {
  1031. "field" : "_value.id",
  1032. "on_failure" : [
  1033. {
  1034. "set" : {
  1035. "field", "_index",
  1036. "value", "failure_index"
  1037. }
  1038. }
  1039. ]
  1040. }
  1041. }
  1042. }
  1043. }
  1044. --------------------------------------------------
  1045. // NOTCONSOLE
  1046. In this example, if the `remove` processor does fail, then
  1047. the array elements that have been processed thus far will
  1048. be updated.
  1049. Another advanced example can be found in the {plugins}/ingest-attachment-with-arrays.html[attachment processor documentation].
  1050. [[grok-processor]]
  1051. === Grok Processor
  1052. Extracts structured fields out of a single text field within a document. You choose which field to
  1053. extract matched fields from, as well as the grok pattern you expect will match. A grok pattern is like a regular
  1054. expression that supports aliased expressions that can be reused.
  1055. This tool is perfect for syslog logs, apache and other webserver logs, mysql logs, and in general, any log format
  1056. that is generally written for humans and not computer consumption.
  1057. This processor comes packaged with over
  1058. https://github.com/elastic/elasticsearch/tree/master/modules/ingest-common/src/main/resources/patterns[120 reusable patterns].
  1059. 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.
  1060. [[grok-basics]]
  1061. ==== Grok Basics
  1062. Grok sits on top of regular expressions, so any regular expressions are valid in grok as well.
  1063. The regular expression library is Oniguruma, and you can see the full supported regexp syntax
  1064. https://github.com/kkos/oniguruma/blob/master/doc/RE[on the Onigiruma site].
  1065. Grok works by leveraging this regular expression language to allow naming existing patterns and combining them into more
  1066. complex patterns that match your fields.
  1067. The syntax for reusing a grok pattern comes in three forms: `%{SYNTAX:SEMANTIC}`, `%{SYNTAX}`, `%{SYNTAX:SEMANTIC:TYPE}`.
  1068. The `SYNTAX` is the name of the pattern that will match your text. For example, `3.44` will be matched by the `NUMBER`
  1069. pattern and `55.3.244.1` will be matched by the `IP` pattern. The syntax is how you match. `NUMBER` and `IP` are both
  1070. patterns that are provided within the default patterns set.
  1071. The `SEMANTIC` is the identifier you give to the piece of text being matched. For example, `3.44` could be the
  1072. duration of an event, so you could call it simply `duration`. Further, a string `55.3.244.1` might identify
  1073. the `client` making a request.
  1074. The `TYPE` is the type you wish to cast your named field. `int` and `float` are currently the only types supported for coercion.
  1075. For example, you might want to match the following text:
  1076. [source,txt]
  1077. --------------------------------------------------
  1078. 3.44 55.3.244.1
  1079. --------------------------------------------------
  1080. 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
  1081. Grok expression.
  1082. [source,txt]
  1083. --------------------------------------------------
  1084. %{NUMBER:duration} %{IP:client}
  1085. --------------------------------------------------
  1086. [[using-grok]]
  1087. ==== Using the Grok Processor in a Pipeline
  1088. [[grok-options]]
  1089. .Grok Options
  1090. [options="header"]
  1091. |======
  1092. | Name | Required | Default | Description
  1093. | `field` | yes | - | The field to use for grok expression parsing
  1094. | `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.
  1095. | `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.
  1096. | `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.
  1097. | `ignore_missing` | no | false | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1098. |======
  1099. Here is an example of using the provided patterns to extract out and name structured fields from a string field in
  1100. a document.
  1101. [source,js]
  1102. --------------------------------------------------
  1103. {
  1104. "message": "55.3.244.1 GET /index.html 15824 0.043"
  1105. }
  1106. --------------------------------------------------
  1107. // NOTCONSOLE
  1108. The pattern for this could be:
  1109. [source,txt]
  1110. --------------------------------------------------
  1111. %{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}
  1112. --------------------------------------------------
  1113. Here is an example pipeline for processing the above document by using Grok:
  1114. [source,js]
  1115. --------------------------------------------------
  1116. {
  1117. "description" : "...",
  1118. "processors": [
  1119. {
  1120. "grok": {
  1121. "field": "message",
  1122. "patterns": ["%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}"]
  1123. }
  1124. }
  1125. ]
  1126. }
  1127. --------------------------------------------------
  1128. // NOTCONSOLE
  1129. This pipeline will insert these named captures as new fields within the document, like so:
  1130. [source,js]
  1131. --------------------------------------------------
  1132. {
  1133. "message": "55.3.244.1 GET /index.html 15824 0.043",
  1134. "client": "55.3.244.1",
  1135. "method": "GET",
  1136. "request": "/index.html",
  1137. "bytes": 15824,
  1138. "duration": "0.043"
  1139. }
  1140. --------------------------------------------------
  1141. // NOTCONSOLE
  1142. [[custom-patterns]]
  1143. ==== Custom Patterns and Pattern Files
  1144. The Grok processor comes pre-packaged with a base set of pattern. These patterns may not always have
  1145. what you are looking for. Pattern have a very basic format. Each entry describes has a name and the pattern itself.
  1146. You can add your own patterns to a processor definition under the `pattern_definitions` option.
  1147. Here is an example of a pipeline specifying custom pattern definitions:
  1148. [source,js]
  1149. --------------------------------------------------
  1150. {
  1151. "description" : "...",
  1152. "processors": [
  1153. {
  1154. "grok": {
  1155. "field": "message",
  1156. "patterns": ["my %{FAVORITE_DOG:dog} is colored %{RGB:color}"]
  1157. "pattern_definitions" : {
  1158. "FAVORITE_DOG" : "beagle",
  1159. "RGB" : "RED|GREEN|BLUE"
  1160. }
  1161. }
  1162. }
  1163. ]
  1164. }
  1165. --------------------------------------------------
  1166. // NOTCONSOLE
  1167. [[trace-match]]
  1168. ==== Providing Multiple Match Patterns
  1169. Sometimes one pattern is not enough to capture the potential structure of a field. Let's assume we
  1170. want to match all messages that contain your favorite pet breeds of either cats or dogs. One way to accomplish
  1171. this is to provide two distinct patterns that can be matched, instead of one really complicated expression capturing
  1172. the same `or` behavior.
  1173. Here is an example of such a configuration executed against the simulate API:
  1174. [source,js]
  1175. --------------------------------------------------
  1176. POST _ingest/pipeline/_simulate
  1177. {
  1178. "pipeline": {
  1179. "description" : "parse multiple patterns",
  1180. "processors": [
  1181. {
  1182. "grok": {
  1183. "field": "message",
  1184. "patterns": ["%{FAVORITE_DOG:pet}", "%{FAVORITE_CAT:pet}"],
  1185. "pattern_definitions" : {
  1186. "FAVORITE_DOG" : "beagle",
  1187. "FAVORITE_CAT" : "burmese"
  1188. }
  1189. }
  1190. }
  1191. ]
  1192. },
  1193. "docs":[
  1194. {
  1195. "_source": {
  1196. "message": "I love burmese cats!"
  1197. }
  1198. }
  1199. ]
  1200. }
  1201. --------------------------------------------------
  1202. // CONSOLE
  1203. response:
  1204. [source,js]
  1205. --------------------------------------------------
  1206. {
  1207. "docs": [
  1208. {
  1209. "doc": {
  1210. "_type": "_type",
  1211. "_index": "_index",
  1212. "_id": "_id",
  1213. "_source": {
  1214. "message": "I love burmese cats!",
  1215. "pet": "burmese"
  1216. },
  1217. "_ingest": {
  1218. "timestamp": "2016-11-08T19:43:03.850+0000"
  1219. }
  1220. }
  1221. }
  1222. ]
  1223. }
  1224. --------------------------------------------------
  1225. // TESTRESPONSE[s/2016-11-08T19:43:03.850\+0000/$body.docs.0.doc._ingest.timestamp/]
  1226. Both patterns will set the field `pet` with the appropriate match, but what if we want to trace which of our
  1227. patterns matched and populated our fields? We can do this with the `trace_match` parameter. Here is the output of
  1228. that same pipeline, but with `"trace_match": true` configured:
  1229. ////
  1230. Hidden setup for example:
  1231. [source,js]
  1232. --------------------------------------------------
  1233. POST _ingest/pipeline/_simulate
  1234. {
  1235. "pipeline": {
  1236. "description" : "parse multiple patterns",
  1237. "processors": [
  1238. {
  1239. "grok": {
  1240. "field": "message",
  1241. "patterns": ["%{FAVORITE_DOG:pet}", "%{FAVORITE_CAT:pet}"],
  1242. "trace_match": true,
  1243. "pattern_definitions" : {
  1244. "FAVORITE_DOG" : "beagle",
  1245. "FAVORITE_CAT" : "burmese"
  1246. }
  1247. }
  1248. }
  1249. ]
  1250. },
  1251. "docs":[
  1252. {
  1253. "_source": {
  1254. "message": "I love burmese cats!"
  1255. }
  1256. }
  1257. ]
  1258. }
  1259. --------------------------------------------------
  1260. // CONSOLE
  1261. ////
  1262. [source,js]
  1263. --------------------------------------------------
  1264. {
  1265. "docs": [
  1266. {
  1267. "doc": {
  1268. "_type": "_type",
  1269. "_index": "_index",
  1270. "_id": "_id",
  1271. "_source": {
  1272. "message": "I love burmese cats!",
  1273. "pet": "burmese"
  1274. },
  1275. "_ingest": {
  1276. "_grok_match_index": "1",
  1277. "timestamp": "2016-11-08T19:43:03.850+0000"
  1278. }
  1279. }
  1280. }
  1281. ]
  1282. }
  1283. --------------------------------------------------
  1284. // TESTRESPONSE[s/2016-11-08T19:43:03.850\+0000/$body.docs.0.doc._ingest.timestamp/]
  1285. 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
  1286. second (index starts at zero) pattern in `patterns` to match.
  1287. This trace metadata enables debugging which of the patterns matched. This information is stored in the ingest
  1288. metadata and will not be indexed.
  1289. [[grok-processor-rest-get]]
  1290. ==== Retrieving patterns from REST endpoint
  1291. The Grok Processor comes packaged with its own REST endpoint for retrieving which patterns the processor is packaged with.
  1292. [source,js]
  1293. --------------------------------------------------
  1294. GET _ingest/processor/grok
  1295. --------------------------------------------------
  1296. // CONSOLE
  1297. The above request will return a response body containing a key-value representation of the built-in patterns dictionary.
  1298. [source,js]
  1299. --------------------------------------------------
  1300. {
  1301. "patterns" : {
  1302. "BACULA_CAPACITY" : "%{INT}{1,3}(,%{INT}{3})*",
  1303. "PATH" : "(?:%{UNIXPATH}|%{WINPATH})",
  1304. ...
  1305. }
  1306. --------------------------------------------------
  1307. // NOTCONSOLE
  1308. This can be useful to reference as the built-in patterns change across versions.
  1309. [[gsub-processor]]
  1310. === Gsub Processor
  1311. Converts a string field by applying a regular expression and a replacement.
  1312. If the field is not a string, the processor will throw an exception.
  1313. [[gsub-options]]
  1314. .Gsub Options
  1315. [options="header"]
  1316. |======
  1317. | Name | Required | Default | Description
  1318. | `field` | yes | - | The field to apply the replacement to
  1319. | `pattern` | yes | - | The pattern to be replaced
  1320. | `replacement` | yes | - | The string to replace the matching patterns with
  1321. | `target_field` | no | `field` | The field to assign the converted value to, by default `field` is updated in-place
  1322. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1323. |======
  1324. [source,js]
  1325. --------------------------------------------------
  1326. {
  1327. "gsub": {
  1328. "field": "field1",
  1329. "pattern": "\.",
  1330. "replacement": "-"
  1331. }
  1332. }
  1333. --------------------------------------------------
  1334. // NOTCONSOLE
  1335. [[join-processor]]
  1336. === Join Processor
  1337. Joins each element of an array into a single string using a separator character between each element.
  1338. Throws an error when the field is not an array.
  1339. [[join-options]]
  1340. .Join Options
  1341. [options="header"]
  1342. |======
  1343. | Name | Required | Default | Description
  1344. | `field` | yes | - | The field to be separated
  1345. | `separator` | yes | - | The separator character
  1346. | `target_field` | no | `field` | The field to assign the joined value to, by default `field` is updated in-place
  1347. |======
  1348. [source,js]
  1349. --------------------------------------------------
  1350. {
  1351. "join": {
  1352. "field": "joined_array_field",
  1353. "separator": "-"
  1354. }
  1355. }
  1356. --------------------------------------------------
  1357. // NOTCONSOLE
  1358. [[json-processor]]
  1359. === JSON Processor
  1360. Converts a JSON string into a structured JSON object.
  1361. [[json-options]]
  1362. .Json Options
  1363. [options="header"]
  1364. |======
  1365. | Name | Required | Default | Description
  1366. | `field` | yes | - | The field to be parsed
  1367. | `target_field` | no | `field` | The field to insert the converted structured object into
  1368. | `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.
  1369. |======
  1370. Suppose you provide this configuration of the `json` processor:
  1371. [source,js]
  1372. --------------------------------------------------
  1373. {
  1374. "json" : {
  1375. "field" : "string_source",
  1376. "target_field" : "json_target"
  1377. }
  1378. }
  1379. --------------------------------------------------
  1380. // NOTCONSOLE
  1381. If the following document is processed:
  1382. [source,js]
  1383. --------------------------------------------------
  1384. {
  1385. "string_source": "{\"foo\": 2000}"
  1386. }
  1387. --------------------------------------------------
  1388. // NOTCONSOLE
  1389. after the `json` processor operates on it, it will look like:
  1390. [source,js]
  1391. --------------------------------------------------
  1392. {
  1393. "string_source": "{\"foo\": 2000}",
  1394. "json_target": {
  1395. "foo": 2000
  1396. }
  1397. }
  1398. --------------------------------------------------
  1399. // NOTCONSOLE
  1400. If the following configuration is provided, omitting the optional `target_field` setting:
  1401. [source,js]
  1402. --------------------------------------------------
  1403. {
  1404. "json" : {
  1405. "field" : "source_and_target"
  1406. }
  1407. }
  1408. --------------------------------------------------
  1409. // NOTCONSOLE
  1410. then after the `json` processor operates on this document:
  1411. [source,js]
  1412. --------------------------------------------------
  1413. {
  1414. "source_and_target": "{\"foo\": 2000}"
  1415. }
  1416. --------------------------------------------------
  1417. // NOTCONSOLE
  1418. it will look like:
  1419. [source,js]
  1420. --------------------------------------------------
  1421. {
  1422. "source_and_target": {
  1423. "foo": 2000
  1424. }
  1425. }
  1426. --------------------------------------------------
  1427. // NOTCONSOLE
  1428. This illustrates that, unless it is explicitly named in the processor configuration, the `target_field`
  1429. is the same field provided in the required `field` configuration.
  1430. [[kv-processor]]
  1431. === KV Processor
  1432. This processor helps automatically parse messages (or specific event fields) which are of the foo=bar variety.
  1433. For example, if you have a log message which contains `ip=1.2.3.4 error=REFUSED`, you can parse those automatically by configuring:
  1434. [source,js]
  1435. --------------------------------------------------
  1436. {
  1437. "kv": {
  1438. "field": "message",
  1439. "field_split": " ",
  1440. "value_split": "="
  1441. }
  1442. }
  1443. --------------------------------------------------
  1444. // NOTCONSOLE
  1445. [[kv-options]]
  1446. .Kv Options
  1447. [options="header"]
  1448. |======
  1449. | Name | Required | Default | Description
  1450. | `field` | yes | - | The field to be parsed
  1451. | `field_split` | yes | - | Regex pattern to use for splitting key-value pairs
  1452. | `value_split` | yes | - | Regex pattern to use for splitting the key from the value within a key-value pair
  1453. | `target_field` | no | `null` | The field to insert the extracted keys into. Defaults to the root of the document
  1454. | `include_keys` | no | `null` | List of keys to filter and insert into document. Defaults to including all keys
  1455. | `exclude_keys` | no | `null` | List of keys to exclude from document
  1456. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1457. |======
  1458. [[lowercase-processor]]
  1459. === Lowercase Processor
  1460. Converts a string to its lowercase equivalent.
  1461. [[lowercase-options]]
  1462. .Lowercase Options
  1463. [options="header"]
  1464. |======
  1465. | Name | Required | Default | Description
  1466. | `field` | yes | - | The field to make lowercase
  1467. | `target_field` | no | `field` | The field to assign the converted value to, by default `field` is updated in-place
  1468. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1469. |======
  1470. [source,js]
  1471. --------------------------------------------------
  1472. {
  1473. "lowercase": {
  1474. "field": "foo"
  1475. }
  1476. }
  1477. --------------------------------------------------
  1478. // NOTCONSOLE
  1479. [[remove-processor]]
  1480. === Remove Processor
  1481. Removes existing fields. If one field doesn't exist, an exception will be thrown.
  1482. [[remove-options]]
  1483. .Remove Options
  1484. [options="header"]
  1485. |======
  1486. | Name | Required | Default | Description
  1487. | `field` | yes | - | Fields to be removed
  1488. |======
  1489. Here is an example to remove a single field:
  1490. [source,js]
  1491. --------------------------------------------------
  1492. {
  1493. "remove": {
  1494. "field": "foo"
  1495. }
  1496. }
  1497. --------------------------------------------------
  1498. // NOTCONSOLE
  1499. To remove multiple fields, you can use the following query:
  1500. [source,js]
  1501. --------------------------------------------------
  1502. {
  1503. "remove": {
  1504. "field": ["foo", "bar"]
  1505. }
  1506. }
  1507. --------------------------------------------------
  1508. // NOTCONSOLE
  1509. [[rename-processor]]
  1510. === Rename Processor
  1511. Renames an existing field. If the field doesn't exist or the new name is already used, an exception will be thrown.
  1512. [[rename-options]]
  1513. .Rename Options
  1514. [options="header"]
  1515. |======
  1516. | Name | Required | Default | Description
  1517. | `field` | yes | - | The field to be renamed
  1518. | `target_field` | yes | - | The new name of the field
  1519. | `ignore_missing` | no | `false` | If `true` and `field` does not exist, the processor quietly exits without modifying the document
  1520. |======
  1521. [source,js]
  1522. --------------------------------------------------
  1523. {
  1524. "rename": {
  1525. "field": "foo",
  1526. "target_field": "foobar"
  1527. }
  1528. }
  1529. --------------------------------------------------
  1530. // NOTCONSOLE
  1531. [[script-processor]]
  1532. === Script Processor
  1533. Allows inline and stored scripts to be executed within ingest pipelines.
  1534. See <<modules-scripting-using, How to use scripts>> to learn more about writing scripts. The Script Processor
  1535. leverages caching of compiled scripts for improved performance. Since the
  1536. script specified within the processor is potentially re-compiled per document, it is important
  1537. to understand how script caching works. To learn more about
  1538. caching see <<modules-scripting-using-caching, Script Caching>>.
  1539. [[script-options]]
  1540. .Script Options
  1541. [options="header"]
  1542. |======
  1543. | Name | Required | Default | Description
  1544. | `lang` | no | "painless" | The scripting language
  1545. | `id` | no | - | The stored script id to refer to
  1546. | `source` | no | - | An inline script to be executed
  1547. | `params` | no | - | Script Parameters
  1548. |======
  1549. One of `id` or `source` options must be provided in order to properly reference a script to execute.
  1550. You can access the current ingest document from within the script context by using the `ctx` variable.
  1551. The following example sets a new field called `field_a_plus_b_times_c` to be the sum of two existing
  1552. numeric fields `field_a` and `field_b` multiplied by the parameter param_c:
  1553. [source,js]
  1554. --------------------------------------------------
  1555. {
  1556. "script": {
  1557. "lang": "painless",
  1558. "source": "ctx.field_a_plus_b_times_c = (ctx.field_a + ctx.field_b) * params.param_c",
  1559. "params": {
  1560. "param_c": 10
  1561. }
  1562. }
  1563. }
  1564. --------------------------------------------------
  1565. // NOTCONSOLE
  1566. It is possible to use the Script Processor to manipulate document metadata like `_index` and `_type` during
  1567. ingestion. Here is an example of an Ingest Pipeline that renames the index and type to `my_index` no matter what
  1568. was provided in the original index request:
  1569. [source,js]
  1570. --------------------------------------------------
  1571. PUT _ingest/pipeline/my_index
  1572. {
  1573. "description": "use index:my_index and type:my_type",
  1574. "processors": [
  1575. {
  1576. "script": {
  1577. "source": " ctx._index = 'my_index'; ctx._type = 'my_type' "
  1578. }
  1579. }
  1580. ]
  1581. }
  1582. --------------------------------------------------
  1583. // CONSOLE
  1584. Using the above pipeline, we can attempt to index a document into the `any_index` index.
  1585. [source,js]
  1586. --------------------------------------------------
  1587. PUT any_index/any_type/1?pipeline=my_index
  1588. {
  1589. "message": "text"
  1590. }
  1591. --------------------------------------------------
  1592. // CONSOLE
  1593. // TEST[continued]
  1594. The response from the above index request:
  1595. [source,js]
  1596. --------------------------------------------------
  1597. {
  1598. "_index": "my_index",
  1599. "_type": "my_type",
  1600. "_id": "1",
  1601. "_version": 1,
  1602. "result": "created",
  1603. "_shards": {
  1604. "total": 2,
  1605. "successful": 1,
  1606. "failed": 0
  1607. },
  1608. "_seq_no": 0,
  1609. "_primary_term": 1,
  1610. }
  1611. --------------------------------------------------
  1612. // TESTRESPONSE
  1613. In the above response, you can see that our document was actually indexed into `my_index` instead of
  1614. `any_index`. This type of manipulation is often convenient in pipelines that have various branches of transformation,
  1615. and depending on the progress made, indexed into different indices.
  1616. [[set-processor]]
  1617. === Set Processor
  1618. Sets one field and associates it with the specified value. If the field already exists,
  1619. its value will be replaced with the provided one.
  1620. [[set-options]]
  1621. .Set Options
  1622. [options="header"]
  1623. |======
  1624. | Name | Required | Default | Description
  1625. | `field` | yes | - | The field to insert, upsert, or update
  1626. | `value` | yes | - | The value to be set for the field
  1627. | `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.
  1628. |======
  1629. [source,js]
  1630. --------------------------------------------------
  1631. {
  1632. "set": {
  1633. "field": "field1",
  1634. "value": 582.1
  1635. }
  1636. }
  1637. --------------------------------------------------
  1638. // NOTCONSOLE
  1639. [[split-processor]]
  1640. === Split Processor
  1641. Splits a field into an array using a separator character. Only works on string fields.
  1642. [[split-options]]
  1643. .Split Options
  1644. [options="header"]
  1645. |======
  1646. | Name | Required | Default | Description
  1647. | `field` | yes | - | The field to split
  1648. | `separator` | yes | - | A regex which matches the separator, eg `,` or `\s+`
  1649. | `target_field` | no | `field` | The field to assign the split value to, by default `field` is updated in-place
  1650. | `ignore_missing` | no | `false` | If `true` and `field` does not exist, the processor quietly exits without modifying the document
  1651. |======
  1652. [source,js]
  1653. --------------------------------------------------
  1654. {
  1655. "split": {
  1656. "field": "my_field",
  1657. "separator": "\\s+" <1>
  1658. }
  1659. }
  1660. --------------------------------------------------
  1661. // NOTCONSOLE
  1662. <1> Treat all consecutive whitespace characters as a single separator
  1663. [[sort-processor]]
  1664. === Sort Processor
  1665. Sorts the elements of an array ascending or descending. Homogeneous arrays of numbers will be sorted
  1666. numerically, while arrays of strings or heterogeneous arrays of strings + numbers will be sorted lexicographically.
  1667. Throws an error when the field is not an array.
  1668. [[sort-options]]
  1669. .Sort Options
  1670. [options="header"]
  1671. |======
  1672. | Name | Required | Default | Description
  1673. | `field` | yes | - | The field to be sorted
  1674. | `order` | no | `"asc"` | The sort order to use. Accepts `"asc"` or `"desc"`.
  1675. | `target_field` | no | `field` | The field to assign the sorted value to, by default `field` is updated in-place
  1676. |======
  1677. [source,js]
  1678. --------------------------------------------------
  1679. {
  1680. "sort": {
  1681. "field": "field_to_sort",
  1682. "order": "desc"
  1683. }
  1684. }
  1685. --------------------------------------------------
  1686. // NOTCONSOLE
  1687. [[trim-processor]]
  1688. === Trim Processor
  1689. Trims whitespace from field.
  1690. NOTE: This only works on leading and trailing whitespace.
  1691. [[trim-options]]
  1692. .Trim Options
  1693. [options="header"]
  1694. |======
  1695. | Name | Required | Default | Description
  1696. | `field` | yes | - | The string-valued field to trim whitespace from
  1697. | `target_field` | no | `field` | The field to assign the trimmed value to, by default `field` is updated in-place
  1698. | `ignore_missing` | no | `false` | If `true` and `field` does not exist, the processor quietly exits without modifying the document
  1699. |======
  1700. [source,js]
  1701. --------------------------------------------------
  1702. {
  1703. "trim": {
  1704. "field": "foo"
  1705. }
  1706. }
  1707. --------------------------------------------------
  1708. // NOTCONSOLE
  1709. [[uppercase-processor]]
  1710. === Uppercase Processor
  1711. Converts a string to its uppercase equivalent.
  1712. [[uppercase-options]]
  1713. .Uppercase Options
  1714. [options="header"]
  1715. |======
  1716. | Name | Required | Default | Description
  1717. | `field` | yes | - | The field to make uppercase
  1718. | `target_field` | no | `field` | The field to assign the converted value to, by default `field` is updated in-place
  1719. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1720. |======
  1721. [source,js]
  1722. --------------------------------------------------
  1723. {
  1724. "uppercase": {
  1725. "field": "foo"
  1726. }
  1727. }
  1728. --------------------------------------------------
  1729. // NOTCONSOLE
  1730. [[dot-expand-processor]]
  1731. === Dot Expander Processor
  1732. Expands a field with dots into an object field. This processor allows fields
  1733. with dots in the name to be accessible by other processors in the pipeline.
  1734. Otherwise these <<accessing-data-in-pipelines,fields>> can't be accessed by any processor.
  1735. [[dot-expender-options]]
  1736. .Dot Expand Options
  1737. [options="header"]
  1738. |======
  1739. | Name | Required | Default | Description
  1740. | `field` | yes | - | The field to expand into an object field
  1741. | `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.
  1742. |======
  1743. [source,js]
  1744. --------------------------------------------------
  1745. {
  1746. "dot_expander": {
  1747. "field": "foo.bar"
  1748. }
  1749. }
  1750. --------------------------------------------------
  1751. // NOTCONSOLE
  1752. For example the dot expand processor would turn this document:
  1753. [source,js]
  1754. --------------------------------------------------
  1755. {
  1756. "foo.bar" : "value"
  1757. }
  1758. --------------------------------------------------
  1759. // NOTCONSOLE
  1760. into:
  1761. [source,js]
  1762. --------------------------------------------------
  1763. {
  1764. "foo" : {
  1765. "bar" : "value"
  1766. }
  1767. }
  1768. --------------------------------------------------
  1769. // NOTCONSOLE
  1770. If there is already a `bar` field nested under `foo` then
  1771. this processor merges the `foo.bar` field into it. If the field is
  1772. a scalar value then it will turn that field into an array field.
  1773. For example, the following document:
  1774. [source,js]
  1775. --------------------------------------------------
  1776. {
  1777. "foo.bar" : "value2",
  1778. "foo" : {
  1779. "bar" : "value1"
  1780. }
  1781. }
  1782. --------------------------------------------------
  1783. // NOTCONSOLE
  1784. is transformed by the `dot_expander` processor into:
  1785. [source,js]
  1786. --------------------------------------------------
  1787. {
  1788. "foo" : {
  1789. "bar" : ["value1", "value2"]
  1790. }
  1791. }
  1792. --------------------------------------------------
  1793. // NOTCONSOLE
  1794. If any field outside of the leaf field conflicts with a pre-existing field of the same name,
  1795. then that field needs to be renamed first.
  1796. Consider the following document:
  1797. [source,js]
  1798. --------------------------------------------------
  1799. {
  1800. "foo": "value1",
  1801. "foo.bar": "value2"
  1802. }
  1803. --------------------------------------------------
  1804. // NOTCONSOLE
  1805. Then the `foo` needs to be renamed first before the `dot_expander`
  1806. processor is applied. So in order for the `foo.bar` field to properly
  1807. be expanded into the `bar` field under the `foo` field the following
  1808. pipeline should be used:
  1809. [source,js]
  1810. --------------------------------------------------
  1811. {
  1812. "processors" : [
  1813. {
  1814. "rename" : {
  1815. "field" : "foo",
  1816. "target_field" : "foo.bar""
  1817. }
  1818. },
  1819. {
  1820. "dot_expander": {
  1821. "field": "foo.bar"
  1822. }
  1823. }
  1824. ]
  1825. }
  1826. --------------------------------------------------
  1827. // NOTCONSOLE
  1828. The reason for this is that Ingest doesn't know how to automatically cast
  1829. a scalar field to an object field.
  1830. [[urldecode-processor]]
  1831. === URL Decode Processor
  1832. URL-decodes a string
  1833. [[urldecode-options]]
  1834. .URL Decode Options
  1835. [options="header"]
  1836. |======
  1837. | Name | Required | Default | Description
  1838. | `field` | yes | - | The field to decode
  1839. | `target_field` | no | `field` | The field to assign the converted value to, by default `field` is updated in-place
  1840. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  1841. |======
  1842. [source,js]
  1843. --------------------------------------------------
  1844. {
  1845. "urldecode": {
  1846. "field": "my_url_to_decode"
  1847. }
  1848. }
  1849. --------------------------------------------------
  1850. // NOTCONSOLE