原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/pipeline-processor.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/pipeline-processor.html

Pipeline Processoredit

Executes another pipeline.

Table 57. Pipeline Options

Name Required Default Description

name

yes

-

The name of the pipeline to execute. Supports template snippets.

if

no

-

Conditionally execute this processor.

on_failure

no

-

Handle failures for this processor. See Handling Failures in Pipelines.

ignore_failure

no

false

Ignore failures for this processor. See Handling Failures in Pipelines.

tag

no

-

An identifier for this processor. Useful for debugging and metrics.

{
  "pipeline": {
    "name": "inner-pipeline"
  }
}

The name of the current pipeline can be accessed from the _ingest.pipeline ingest metadata key.

An example of using this processor for nesting pipelines would be:

Define an inner pipeline:

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:

PUT _ingest/pipeline/pipelineB
{
  "description" : "outer pipeline",
  "processors" : [
    {
      "pipeline" : {
        "name": "pipelineA"
      }
    },
    {
      "set" : {
        "field": "outer_pipeline_set",
        "value": "outer"
      }
    }
  ]
}

Now indexing a document while applying the outer pipeline will see the inner pipeline executed from the outer pipeline:

PUT /myindex/_doc/1?pipeline=pipelineB
{
  "field": "value"
}

Response from the index request:

{
  "_index": "myindex",
  "_type": "_doc",
  "_id": "1",
  "_version": 1,
  "result": "created",
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  },
  "_seq_no": 66,
  "_primary_term": 1,
}

Indexed document:

{
  "field": "value",
  "inner_pipeline_set": "inner",
  "outer_pipeline_set": "outer"
}