2018-12-20 08:04:54 -05:00
|
|
|
[[pipeline-processor]]
|
2020-08-12 11:49:54 -04:00
|
|
|
=== Pipeline processor
|
|
|
|
++++
|
|
|
|
<titleabbrev>Pipeline</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
2018-12-20 08:04:54 -05:00
|
|
|
Executes another pipeline.
|
|
|
|
|
|
|
|
[[pipeline-options]]
|
|
|
|
.Pipeline Options
|
|
|
|
[options="header"]
|
|
|
|
|======
|
|
|
|
| Name | Required | Default | Description
|
2019-11-27 09:53:40 -05:00
|
|
|
| `name` | yes | - | The name of the pipeline to execute. Supports <<accessing-template-fields,template snippets>>.
|
2018-12-20 08:04:54 -05:00
|
|
|
include::common-options.asciidoc[]
|
|
|
|
|======
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"pipeline": {
|
|
|
|
"name": "inner-pipeline"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// NOTCONSOLE
|
|
|
|
|
2020-01-16 04:50:47 -05:00
|
|
|
The name of the current pipeline can be accessed from the `_ingest.pipeline` ingest metadata key.
|
|
|
|
|
2018-12-20 08:04:54 -05:00
|
|
|
An example of using this processor for nesting pipelines would be:
|
|
|
|
|
|
|
|
Define an inner pipeline:
|
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2018-12-20 08:04:54 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
PUT _ingest/pipeline/pipelineA
|
|
|
|
{
|
|
|
|
"description" : "inner pipeline",
|
|
|
|
"processors" : [
|
|
|
|
{
|
|
|
|
"set" : {
|
|
|
|
"field": "inner_pipeline_set",
|
|
|
|
"value": "inner"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
Define another pipeline that uses the previously defined inner pipeline:
|
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2018-12-20 08:04:54 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
PUT _ingest/pipeline/pipelineB
|
|
|
|
{
|
|
|
|
"description" : "outer pipeline",
|
|
|
|
"processors" : [
|
|
|
|
{
|
|
|
|
"pipeline" : {
|
|
|
|
"name": "pipelineA"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"set" : {
|
|
|
|
"field": "outer_pipeline_set",
|
|
|
|
"value": "outer"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
|
|
|
Now indexing a document while applying the outer pipeline will see the inner pipeline executed
|
|
|
|
from the outer pipeline:
|
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2018-12-20 08:04:54 -05:00
|
|
|
--------------------------------------------------
|
2020-07-27 15:58:26 -04:00
|
|
|
PUT /my-index/_doc/1?pipeline=pipelineB
|
2018-12-20 08:04:54 -05:00
|
|
|
{
|
|
|
|
"field": "value"
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
|
|
|
Response from the index request:
|
|
|
|
|
2019-09-06 16:09:09 -04:00
|
|
|
[source,console-result]
|
2018-12-20 08:04:54 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
2020-07-27 15:58:26 -04:00
|
|
|
"_index": "my-index",
|
2018-12-20 08:04:54 -05:00
|
|
|
"_type": "_doc",
|
|
|
|
"_id": "1",
|
|
|
|
"_version": 1,
|
|
|
|
"result": "created",
|
|
|
|
"_shards": {
|
|
|
|
"total": 2,
|
|
|
|
"successful": 1,
|
|
|
|
"failed": 0
|
|
|
|
},
|
|
|
|
"_seq_no": 66,
|
|
|
|
"_primary_term": 1,
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TESTRESPONSE[s/"_seq_no": \d+/"_seq_no" : $body._seq_no/ s/"_primary_term" : 1/"_primary_term" : $body._primary_term/]
|
|
|
|
|
|
|
|
Indexed document:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"field": "value",
|
|
|
|
"inner_pipeline_set": "inner",
|
|
|
|
"outer_pipeline_set": "outer"
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// NOTCONSOLE
|