---
type: api
title: Create or update a pipeline
description: Changes made using this API take effect immediately.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/operation/operation-ingest-put-pipeline
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/operation/operation-ingest-put-pipeline
products:
  - Elasticsearch Serverless
---

# Create or update a pipeline

Availability:

## Paths

- `PUT` `/_ingest/pipeline/{id}`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/authentication#apikeyauth)

#### Path Parameters

- `id` (string Id)
  ID of the ingest pipeline to create or update.

## Description

Changes made using this API take effect immediately.

[About ingest pipelines](https://www.elastic.co/docs/manage-data/ingest/transform-enrich/ingest-pipelines)

## Query String Parameters

- `master_timeout` (string Duration · default: 30s)
  Period 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.
- `timeout` (string Duration · default: 30s)
  Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
- `if_version` (number)
  Required version for optimistic concurrency control for pipeline updates

## Request Body

`application/json`

- `_meta` (Metadata) — optional
  Optional metadata about the ingest pipeline. May have any contents. This map is not automatically generated by Elasticsearch.
- `description` (string) — optional
  Description of the ingest pipeline.
- `on_failure` ([] {} ProcessorContainer) — optional
  Processors to run immediately after a processor failure. Each processor supports a processor-level `on_failure` value. If a processor without an `on_failure` value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors.
  See [ProcessorContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/ingest-_types-processorcontainer)
- `processors` ([] {} ProcessorContainer) — optional
  Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified.
  See [ProcessorContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/ingest-_types-processorcontainer)
- `version` (number VersionNumber) — optional
  Version number used by external systems to track ingest pipelines. This parameter is intended for external systems only. Elasticsearch does not use or validate pipeline version numbers.
- `deprecated` (boolean · default: false) — optional
  Marks this ingest pipeline as deprecated.
When a deprecated ingest pipeline is referenced as the default or final pipeline when creating or updating a non-deprecated index template, Elasticsearch will emit a deprecation warning.
- `field_access_pattern` (enum FieldAccessPattern · default: classic) — optional
  Controls how processors in this pipeline should read and write data on a document's source.
  Values: `classic`, `flexible`

## Response

`application/json`

- `acknowledged` (boolean)
  For a successful response, this value is always true. On failure, an exception is returned instead.
## Code Examples

#### Console

```console
PUT _ingest/pipeline/my-pipeline-id
{
  "description" : "My optional pipeline description",
  "processors" : [
    {
      "set" : {
        "description" : "My optional processor description",
        "field": "my-keyword-field",
        "value": "foo"
      }
    }
  ]
}
```

#### JavaScript

```javascript
const response = await client.ingest.putPipeline({
  id: "my-pipeline-id",
  description: "My optional pipeline description",
  processors: [
    {
      set: {
        description: "My optional processor description",
        field: "my-keyword-field",
        value: "foo",
      },
    },
  ],
});
```

#### Python

```python
resp = client.ingest.put_pipeline(
    id="my-pipeline-id",
    description="My optional pipeline description",
    processors=[
        {
            "set": {
                "description": "My optional processor description",
                "field": "my-keyword-field",
                "value": "foo"
            }
        }
    ],
)
```

#### curl

```curl
curl -X PUT "$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "My optional pipeline description",
    "processors": [
      {
        "set": {
          "description": "My optional processor description",
          "field": "my-keyword-field",
          "value": "foo"
        }
      }
    ]
  }'
```

#### Java

```java
client.ingest().putPipeline(p -> p
    .description("My optional pipeline description")
    .id("my-pipeline-id")
    .processors(pr -> pr
        .set(s -> s
            .field("my-keyword-field")
            .value(JsonData.fromJson("\"foo\""))
            .description("My optional processor description")
        )
    )
);
```

#### C#

```c#
var response = await client.Ingest
    .PutPipelineAsync(id: "my-pipeline-id", d1 => d1
        .Description("My optional pipeline description")
        .Processors(d2 => d2
            .Set(d3 => d3
                .Description("My optional processor description")
                .Field(x => x.MyKeywordField)
                .Value("foo")
            )
        )
    );
```

#### PHP

```php
$resp = $client->ingest()->putPipeline([
    "id" => "my-pipeline-id",
    "body" => [
        "description" => "My optional pipeline description",
        "processors" => array(
            [
                "set" => [
                    "description" => "My optional processor description",
                    "field" => "my-keyword-field",
                    "value" => "foo",
                ],
            ],
        ),
    ],
]);
```

#### Ruby

```ruby
response = client.ingest.put_pipeline(
  id: "my-pipeline-id",
  body: {
    "description": "My optional pipeline description",
    "processors": [
      {
        "set": {
          "description": "My optional processor description",
          "field": "my-keyword-field",
          "value": "foo"
        }
      }
    ]
  }
)
```

