put-pipeline.asciidoc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. [[put-pipeline-api]]
  2. === Create or update pipeline API
  3. ++++
  4. <titleabbrev>Create or update pipeline</titleabbrev>
  5. ++++
  6. .New API reference
  7. [sidebar]
  8. --
  9. For the most up-to-date API details, refer to {api-es}/group/endpoint-ingest[Ingest APIs].
  10. --
  11. Creates or updates an <<ingest,ingest pipeline>>. Changes made using this API
  12. take effect immediately.
  13. [source,console]
  14. ----
  15. PUT _ingest/pipeline/my-pipeline-id
  16. {
  17. "description" : "My optional pipeline description",
  18. "processors" : [
  19. {
  20. "set" : {
  21. "description" : "My optional processor description",
  22. "field": "my-keyword-field",
  23. "value": "foo"
  24. }
  25. }
  26. ]
  27. }
  28. ----
  29. [[put-pipeline-api-request]]
  30. ==== {api-request-title}
  31. `PUT /_ingest/pipeline/<pipeline>`
  32. [[put-pipeline-api-prereqs]]
  33. ==== {api-prereq-title}
  34. * If the {es} {security-features} are enabled, you must have the
  35. `manage_pipeline`, `manage_ingest_pipelines`, or `manage`
  36. <<privileges-list-cluster,cluster privilege>> to use this API.
  37. [[put-pipeline-api-path-params]]
  38. ==== {api-path-parms-title}
  39. `<pipeline>`::
  40. (Required, string) ID of the ingest pipeline to create or update.
  41. +
  42. [IMPORTANT]
  43. ====
  44. To avoid naming collisions with built-in and Fleet-managed ingest pipelines, avoid using `@` as part of your own ingest pipelines names.
  45. The exception of that rule are the `*@custom` ingest pipelines that let you safely add a custom pipeline to managed pipelines.
  46. See also <<pipelines-for-fleet-elastic-agent>>.
  47. ====
  48. [[put-pipeline-api-query-params]]
  49. ==== {api-query-parms-title}
  50. `if_version`::
  51. (Optional, integer) Perform the operation only if the pipeline has this
  52. version. If specified and the update is successful, the pipeline's
  53. version is incremented.
  54. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  55. [[put-pipeline-api-request-body]]
  56. ==== {api-request-body-title}
  57. // tag::pipeline-object[]
  58. `description`::
  59. (Optional, string)
  60. Description of the ingest pipeline.
  61. `on_failure`::
  62. (Optional, array of <<processors,processor>> objects)
  63. Processors to run immediately after a processor failure.
  64. +
  65. Each processor supports a processor-level `on_failure` value. If a processor
  66. without an `on_failure` value fails, {es} uses this pipeline-level parameter as
  67. a fallback. The processors in this parameter run sequentially in the order
  68. specified. {es} will not attempt to run the pipeline's remaining processors.
  69. `processors`::
  70. (Required, array of <<processors,processor>> objects)
  71. Processors used to perform transformations on documents before indexing.
  72. Processors run sequentially in the order specified.
  73. `version`::
  74. (Optional, integer)
  75. Version number used by external systems to track ingest pipelines.
  76. +
  77. See the <<put-pipeline-api-query-params,`if_version`>> parameter above for
  78. how the version attribute is used.
  79. `_meta`::
  80. (Optional, object)
  81. Optional metadata about the ingest pipeline. May have any contents. This
  82. map is not automatically generated by {es}.
  83. `deprecated`::
  84. (Optional, boolean)
  85. Marks this ingest pipeline as deprecated.
  86. When a deprecated ingest pipeline is referenced as the default or final pipeline when creating or updating a non-deprecated index template,
  87. {es} will emit a deprecation warning.
  88. // end::pipeline-object[]
  89. [[put-pipeline-api-example]]
  90. ==== {api-examples-title}
  91. [[pipeline-metadata]]
  92. ===== Pipeline metadata
  93. You can use the `_meta` parameter to add arbitrary metadata to a pipeline.
  94. This user-defined object is stored in the cluster state,
  95. so keeping it short is preferable.
  96. The `_meta` parameter is optional and not automatically generated or used by {es}.
  97. To unset `_meta`, replace the pipeline without specifying one.
  98. [source,console]
  99. --------------------------------------------------
  100. PUT /_ingest/pipeline/my-pipeline-id
  101. {
  102. "description" : "My optional pipeline description",
  103. "processors" : [
  104. {
  105. "set" : {
  106. "description" : "My optional processor description",
  107. "field": "my-keyword-field",
  108. "value": "foo"
  109. }
  110. }
  111. ],
  112. "_meta": {
  113. "reason": "set my-keyword-field to foo",
  114. "serialization": {
  115. "class": "MyPipeline",
  116. "id": 10
  117. }
  118. }
  119. }
  120. --------------------------------------------------
  121. To check the `_meta`, use the <<get-pipeline-api,get pipeline>> API.