Link Search Menu Expand Document Documentation Menu

You're viewing version 2.13 of the OpenSearch documentation. This version is no longer maintained. For the latest version, see the current documentation. For information about OpenSearch version maintenance, see Release Schedule and Maintenance Policy.

Create pipeline

Introduced 1.0

Use the create pipeline API operation to create or update pipelines in OpenSearch. Note that the pipeline requires you to define at least one processor that specifies how to change the documents.

Path and HTTP method

Replace <pipeline-id> with your pipeline ID:

PUT _ingest/pipeline/<pipeline-id>

Example request

Here is an example in JSON format that creates an ingest pipeline with two set processors and an uppercase processor. The first set processor sets the grad_year to 2023, and the second set processor sets graduated to true. The uppercase processor converts the name field to uppercase.

PUT _ingest/pipeline/my-pipeline
{
  "description": "This pipeline processes student data",
  "processors": [
    {
      "set": {
        "description": "Sets the graduation year to 2023",
        "field": "grad_year",
        "value": 2023
      }
    },
    {
      "set": {
        "description": "Sets graduated to true",
        "field": "graduated",
        "value": true
      }
    },
    {
      "uppercase": {
        "field": "name"
      }
    }
  ]
}

To learn more about error handling, see Handling pipeline failures.

Request body fields

The following table lists the request body fields used to create or update a pipeline.

Parameter Required Type Description
processors Required Array of processor objects An array of processors, each of which transforms documents. Processors are run sequentially in the order specified.
description Optional String A description of your ingest pipeline.

Path parameters

Parameter Required Type Description
pipeline-id Required String The unique identifier, or pipeline ID, assigned to the ingest pipeline.

Query parameters

Parameter Required Type Description
cluster_manager_timeout Optional Time Period to wait for a connection to the cluster manager node. Defaults to 30 seconds.
timeout Optional Time Period to wait for a response. Defaults to 30 seconds.

Template snippets

Some processor parameters support Mustache template snippets. To get the value of a field, surround the field name in three curly braces, for example, {{{field-name}}}.

Example: set ingest processor using Mustache template snippet

The following example sets the field {{{role}}} with a value {{{tenure}}}:

PUT _ingest/pipeline/my-pipeline
{
 "processors": [
    {
      "set": {
        "field": "{{{role}}}",
        "value": "{{{tenure}}}"
         }
    }
  ]
}

350 characters left

Have a question? .

Want to contribute? or .