# What does event.cancel() do?

**URL:** <https://discuss.elastic.co/t/what-does-event-cancel-do/223482>\
**Category:** Logstash\
**Created:** [March 13, 2020, 9:07am UTC](https://discuss.elastic.co/t/what-does-event-cancel-do/223482 "2020-03-13T09:07:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtboing](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jtboing/32/59438_2.png) [@jtboing](https://discuss.elastic.co/u/jtboing)\
**Post date:** [March 13, 2020, 9:07am UTC](https://discuss.elastic.co/t/what-does-event-cancel-do/223482/1 "2020-03-13T09:07:09Z")

</div>

I've recently been using logstash to pass data from the database to elaticsearch. One of the plugins that I'm using is the aggregate filter. In some of the examples, there is `event.cancel()` that is said to cancel events.

What does this really mean? Are the events from the events API just deleted? Would love to hear anything from someone that knows. Thanks!

---

<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 13, 2020, 5:52pm UTC](https://discuss.elastic.co/t/what-does-event-cancel-do/223482/2 "2020-03-13T17:52:43Z")

</div>

event.cancel just deletes the event that is being processed. You would use it circumstances where aggregate saves all the required fields from the event in the map and then creates a new event later (i.e. either push\_map\_as\_event\_on\_timeout or push\_previous\_map\_as\_event is set).

---

<div class="post-metadata">

**Author:** ![jtboing](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jtboing/32/59438_2.png) [@jtboing](https://discuss.elastic.co/u/jtboing)\
**Post date:** [March 16, 2020, 3:38am UTC](https://discuss.elastic.co/t/what-does-event-cancel-do/223482/3 "2020-03-16T03:38:38Z")

</div>

I see. So, you would use event.cancel in order to prevent currently processed events being used any further?

---

<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 16, 2020, 4:51pm UTC](https://discuss.elastic.co/t/what-does-event-cancel-do/223482/4 "2020-03-16T16:51:04Z")

</div>

Exactly.

---

<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, 2020, 4:51pm UTC](https://discuss.elastic.co/t/what-does-event-cancel-do/223482/5 "2020-04-13T16:51:06Z")

</div>

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