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

Put pipeline APIedit

Creates or updates an ingest pipeline. Changes made using this API take effect immediately.

PUT _ingest/pipeline/my-pipeline-id
{
  "description" : "describe pipeline",
  "processors" : [
    {
      "set" : {
        "field": "foo",
        "value": "bar"
      }
    }
  ]
}

Requestedit

PUT /_ingest/pipeline/<pipeline>

Path parametersedit

<pipeline>
(Required, string) ID of the ingest pipeline to create or update.

Query parametersedit

master_timeout
(Optional, time units) Specifies the period of time to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s.

Request bodyedit

description
(Required, string) Description of the ingest pipeline.
processors

(Required, array of processor objects) Array of processors used to pre-process documents before indexing.

Processors are executed in the order provided.

See Processors for processor object definitions and a list of built-in processors.

version

(Optional, integer) Optional version number used by external systems to manage ingest pipelines.

Versions are not used or validated by Elasticsearch; they are intended for external management only.

Examplesedit

Pipeline versioningedit

When creating or updating an ingest pipeline, you can specify an optional version parameter. The version is useful for managing changes to pipeline and viewing the current pipeline for an ingest node.

The following request sets a version number of 123 for my-pipeline-id.

PUT /_ingest/pipeline/my-pipeline-id
{
  "description" : "describe pipeline",
  "version" : 123,
  "processors" : [
    {
      "set" : {
        "field": "foo",
        "value": "bar"
      }
    }
  ]
}

To unset the version number, replace the pipeline without specifying a version parameter.

PUT /_ingest/pipeline/my-pipeline-id
{
  "description" : "describe pipeline",
  "processors" : [
    {
      "set" : {
        "field": "foo",
        "value": "bar"
      }
    }
  ]
}