pipeline.asciidoc 2.4 KB

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