# How to use ingest pipeline with logstash elaticsearch output update feature

**URL:** <https://discuss.elastic.co/t/how-to-use-ingest-pipeline-with-logstash-elaticsearch-output-update-feature/244314>\
**Category:** Elasticsearch\
**Created:** [August 9, 2020, 4:42pm UTC](https://discuss.elastic.co/t/how-to-use-ingest-pipeline-with-logstash-elaticsearch-output-update-feature/244314 "2020-08-09T16:42:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nuwancs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nuwancs/32/46419_2.png) [@nuwancs](https://discuss.elastic.co/u/nuwancs)\
**Post date:** [August 9, 2020, 4:42pm UTC](https://discuss.elastic.co/t/how-to-use-ingest-pipeline-with-logstash-elaticsearch-output-update-feature/244314/1 "2020-08-09T16:42:58Z")

</div>

I am using Logstash Elasticsearch output to publish data to Elasticsearch. Two records are merged to create a single record from a request and a response. This code is working with no issues.

```auto
elasticsearch {
  hosts => ["localhost:9200"]
  index => "transactions"
  action => "update"
  doc_as_upsert => true
  document_id => "%{tid}"
  script =>'
    if(ctx._source.transaction=="request"){
      ctx._source.status = params.event.get("status");
    }else if(ctx._source.transaction=="response"){                           
      ctx._source.api = params.event.get("api");                        	
    }
}

```

Now I am trying to do add a new field with above record update using ingest pipelines.

```auto
PUT _ingest/pipeline/ingest_pipe2
{
  "description" : "describe pipeline",
  "processors" : [
    {
      "set" : {
        "field": "api-test",
        "value": "new"
      }
    }
  ]
}

```

This will add a new field to the incoming event. It works fine with following code.

```auto
elasticsearch {
  hosts => ["localhost:9200"]
  index => "transactions"
  pipeline => "ingest_pipe2"  
}

```

The problem is both logstash update and ingest pipeline update doesn't work together.

```auto
elasticsearch {
  hosts => ["localhost:9200"]
  index => "transactions"
  pipeline => "ingest_pipe2"**
  action => "update"
  doc_as_upsert => true
  document_id => "%{tid}"
  script =>'
    if(ctx._source.transaction=="request"){
      ctx._source.status = params.event.get("status");
    }else if(ctx._source.transaction=="response"){                           
      ctx._source.api = params.event.get("api");                        	
    }
}

```

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 11, 2020, 12:19pm UTC](https://discuss.elastic.co/t/how-to-use-ingest-pipeline-with-logstash-elaticsearch-output-update-feature/244314/2 "2020-08-11T12:19:33Z")

</div>

I believe ingest pipelines [only intercept index requests](https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ingest.html) (even if part of a bulk request), and not update requests. I therefore do not think what you are tryinbg to do is possible. You may need to add the field through the update script.

---

<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:** [September 8, 2020, 12:19pm UTC](https://discuss.elastic.co/t/how-to-use-ingest-pipeline-with-logstash-elaticsearch-output-update-feature/244314/3 "2020-09-08T12:19:36Z")

</div>

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