This version of the OpenSearch documentation 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

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:

  1. 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.

  1. PUT _ingest/pipeline/my-pipeline
  2. {
  3. "description": "This pipeline processes student data",
  4. "processors": [
  5. {
  6. "set": {
  7. "description": "Sets the graduation year to 2023",
  8. "field": "grad_year",
  9. "value": 2023
  10. }
  11. },
  12. {
  13. "set": {
  14. "description": "Sets graduated to true",
  15. "field": "graduated",
  16. "value": true
  17. }
  18. },
  19. {
  20. "uppercase": {
  21. "field": "name"
  22. }
  23. }
  24. ]
  25. }

copy

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.

ParameterRequiredTypeDescription
processorsRequiredArray of processor objectsAn array of processors, each of which transforms documents. Processors are run sequentially in the order specified.
descriptionOptionalStringA description of your ingest pipeline.

Path parameters

ParameterRequiredTypeDescription
pipeline-idRequiredStringThe unique identifier, or pipeline ID, assigned to the ingest pipeline.

Query parameters

ParameterRequiredTypeDescription
cluster_manager_timeoutOptionalTimePeriod to wait for a connection to the cluster manager node. Defaults to 30 seconds.
timeoutOptionalTimePeriod 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}}}:

  1. PUT _ingest/pipeline/my-pipeline
  2. {
  3. "processors": [
  4. {
  5. "set": {
  6. "field": "{{{role}}}",
  7. "value": "{{{tenure}}}"
  8. }
  9. }
  10. ]
  11. }

copy