# Ingest pipeline in Update Api

**URL:** <https://discuss.elastic.co/t/ingest-pipeline-in-update-api/226412>\
**Category:** Elasticsearch\
**Created:** [April 3, 2020, 2:11pm UTC](https://discuss.elastic.co/t/ingest-pipeline-in-update-api/226412 "2020-04-03T14:11:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattiacareddu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattiacareddu/32/60917_2.png) [@mattiacareddu](https://discuss.elastic.co/u/mattiacareddu)\
**Post date:** [April 3, 2020, 2:11pm UTC](https://discuss.elastic.co/t/ingest-pipeline-in-update-api/226412/1 "2020-04-03T14:11:12Z")

</div>

Hi,

I'm trying to use an ingest pipeline in an update api: POST /my\_index/\_update/\_id?pipeline=attachment

I find out [this issue](https://github.com/elastic/elasticsearch/issues/17895) but it is 4 years old. Is there any update on that after 4 years?  
I really don't like the idea of using a temporary index where I index my document using the ingest pipeline, get the result, and index the result in the final index.  
With a huge amount of data this will become a huge amount of useless work.

To give you a better idea this is my pipeline:

```
{
    "description": "Extract attachment information",
    "processors": [
        {
            "foreach": {
                "field": "attachments",
                "processor": {
                  "attachment": {
                    "target_field": "_ingest._value.attachment",
                    "field": "_ingest._value.data",
                    "ignore_failure" : true
                  }
                }
            }
        },
        {
            "foreach": {
                "field": "attachments",
                "processor": {
                  "remove": {
                    "field": "_ingest._value.data"
                  }
                }
            }
        }
    ]
}

```

what I'm trying to do is simply:

```
POST /my_index/_update/_id?pipeline=attachment
{
  "script" : {
    "source": "ctx._source.attachments.add(params.data)",
    "lang": "painless",
    "params": {
      "data": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="
    }
  }
}

```

which is the same idea of what I do when I index a document

```
PUT /my_index/_doc/_id?pipeline=attachment
{
  "attachments": [
    {"data": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="},
    {"data": "dGVzdCEK"}
  ]
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 1, 2020, 2:11pm UTC](https://discuss.elastic.co/t/ingest-pipeline-in-update-api/226412/2 "2020-05-01T14:11:14Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
