pipeline.asciidoc 2.5 KB

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