# How can I delete changing rows?

**URL:** <https://discuss.elastic.co/t/how-can-i-delete-changing-rows/168877>\
**Category:** Logstash\
**Created:** [February 18, 2019, 4:51pm UTC](https://discuss.elastic.co/t/how-can-i-delete-changing-rows/168877 "2019-02-18T16:51:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alchimia](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@alchimia](https://discuss.elastic.co/u/alchimia)\
**Post date:** [February 18, 2019, 4:51pm UTC](https://discuss.elastic.co/t/how-can-i-delete-changing-rows/168877/1 "2019-02-18T16:51:22Z")

</div>

Hi, I have some rows I need to insert and after to update or delete if they change. I think I should use an upsert but I don't know how to.

I have:

- request number (key)
- request status (number)

If the request is status 1, i have to insert it. If the same request changes and become status 10, i have to delete it. I think I can use the upsert but I don't know exactly how to manage the situation:

```
        action => "delete"
        doc_as_upsert => "true"
        document_id => "%{request_id}"

```

Can someone help me? What can i should do?

---

<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:** [March 18, 2019, 4:51pm UTC](https://discuss.elastic.co/t/how-can-i-delete-changing-rows/168877/2 "2019-03-18T16:51:29Z")

</div>

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