pipeline.asciidoc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. [[pipeline-processor]]
  2. === Pipeline processor
  3. ++++
  4. <titleabbrev>Pipeline</titleabbrev>
  5. ++++
  6. Executes another pipeline.
  7. [[pipeline-options]]
  8. .Pipeline Options
  9. [options="header"]
  10. |======
  11. | Name | Required | Default | Description
  12. | `name` | yes | - | The name of the pipeline to execute. Supports <<template-snippets,template snippets>>.
  13. include::common-options.asciidoc[]
  14. |======
  15. [source,js]
  16. --------------------------------------------------
  17. {
  18. "pipeline": {
  19. "name": "inner-pipeline"
  20. }
  21. }
  22. --------------------------------------------------
  23. // NOTCONSOLE
  24. The name of the current pipeline can be accessed from the `_ingest.pipeline` ingest metadata key.
  25. An example of using this processor for nesting pipelines would be:
  26. Define an inner pipeline:
  27. [source,console]
  28. --------------------------------------------------
  29. PUT _ingest/pipeline/pipelineA
  30. {
  31. "description" : "inner pipeline",
  32. "processors" : [
  33. {
  34. "set" : {
  35. "field": "inner_pipeline_set",
  36. "value": "inner"
  37. }
  38. }
  39. ]
  40. }
  41. --------------------------------------------------
  42. Define another pipeline that uses the previously defined inner pipeline:
  43. [source,console]
  44. --------------------------------------------------
  45. PUT _ingest/pipeline/pipelineB
  46. {
  47. "description" : "outer pipeline",
  48. "processors" : [
  49. {
  50. "pipeline" : {
  51. "name": "pipelineA"
  52. }
  53. },
  54. {
  55. "set" : {
  56. "field": "outer_pipeline_set",
  57. "value": "outer"
  58. }
  59. }
  60. ]
  61. }
  62. --------------------------------------------------
  63. // TEST[continued]
  64. Now indexing a document while applying the outer pipeline will see the inner pipeline executed
  65. from the outer pipeline:
  66. [source,console]
  67. --------------------------------------------------
  68. PUT /my-index-000001/_doc/1?pipeline=pipelineB
  69. {
  70. "field": "value"
  71. }
  72. --------------------------------------------------
  73. // TEST[continued]
  74. Response from the index request:
  75. [source,console-result]
  76. --------------------------------------------------
  77. {
  78. "_index": "my-index-000001",
  79. "_id": "1",
  80. "_version": 1,
  81. "result": "created",
  82. "_shards": {
  83. "total": 2,
  84. "successful": 1,
  85. "failed": 0
  86. },
  87. "_seq_no": 66,
  88. "_primary_term": 1,
  89. }
  90. --------------------------------------------------
  91. // TESTRESPONSE[s/"_seq_no": \d+/"_seq_no" : $body._seq_no/ s/"_primary_term" : 1/"_primary_term" : $body._primary_term/]
  92. Indexed document:
  93. [source,js]
  94. --------------------------------------------------
  95. {
  96. "field": "value",
  97. "inner_pipeline_set": "inner",
  98. "outer_pipeline_set": "outer"
  99. }
  100. --------------------------------------------------
  101. // NOTCONSOLE