# Edit field "action"

**URL:** <https://discuss.elastic.co/t/edit-field-action/267291>\
**Category:** Logstash\
**Created:** [March 15, 2021, 4:51pm UTC](https://discuss.elastic.co/t/edit-field-action/267291 "2021-03-15T16:51:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lele15](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@lele15](https://discuss.elastic.co/u/lele15)\
**Post date:** [March 15, 2021, 4:51pm UTC](https://discuss.elastic.co/t/edit-field-action/267291/1 "2021-03-15T16:51:03Z")

</div>

Hi, i'm new on ES and i have a problem with csv ingestion.  
I want to edit data on ES when a field has a specific value.

Like:  
Id,Name,Operation  
1,Jack,Edit  
2,,Delete

I want something like this in my Logstash configuration:  
`input {  
stdin{}  
}

```
filter {
  csv {
      separator => ","
      skip_header => "true"
      columns => ["id","clientName","operation"] --> 
  }
  
}

output {
   if ("delete" == "%operation"){
    elasticsearch {
                    action => "delete" 
                    document_id => "%{id}"  
                    index => "index"
                    hosts => ["127.0.0.1:9200"]
        }
} else { #update
}    
        stdout { codec => rubydebug }
}`

```

it is possibile?  
thanks for the answers

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [March 15, 2021, 5:12pm UTC](https://discuss.elastic.co/t/edit-field-action/267291/2 "2021-03-15T17:12:56Z")

</div>

> [@lele15](#):
>
> `if ("delete" == "%operation"){`

That should be

```
if [operation] == "delete" {

```

---

<div class="post-metadata">

**Author:** ![lele15](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@lele15](https://discuss.elastic.co/u/lele15)\
**Post date:** [March 16, 2021, 8:33am UTC](https://discuss.elastic.co/t/edit-field-action/267291/3 "2021-03-16T08:33:08Z")

</div>

it works well, thanks

---

<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:** [April 13, 2021, 8:33am UTC](https://discuss.elastic.co/t/edit-field-action/267291/4 "2021-04-13T08:33:51Z")

</div>

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