# Best way to drop event based on the value(in an array) of a field

**URL:** <https://discuss.elastic.co/t/best-way-to-drop-event-based-on-the-value-in-an-array-of-a-field/232883>\
**Category:** Logstash\
**Created:** [May 15, 2020, 8:53pm UTC](https://discuss.elastic.co/t/best-way-to-drop-event-based-on-the-value-in-an-array-of-a-field/232883 "2020-05-15T20:53:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElasticLiver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticliver/32/64869_2.png) [@ElasticLiver](https://discuss.elastic.co/u/ElasticLiver)\
**Post date:** [May 15, 2020, 8:53pm UTC](https://discuss.elastic.co/t/best-way-to-drop-event-based-on-the-value-in-an-array-of-a-field/232883/1 "2020-05-15T20:53:44Z")

</div>

Hi I want to drop an event if the field "group" contains any of the values in an array, it seems that this is the way to do it, but I was wondering if this is the best way to do it, especially because the array has arround 25 elements.

```auto
 if [group] in ["abc","def","ghi"]{ 
    drop{}
}

```

---

<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:** [May 15, 2020, 9:32pm UTC](https://discuss.elastic.co/t/best-way-to-drop-event-based-on-the-value-in-an-array-of-a-field/232883/2 "2020-05-15T21:32:26Z")

</div>

That's the way I would do it unless I had a _very_ large number of values to check for, in which case I would use a translate filter.

---

<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:** [June 12, 2020, 9:32pm UTC](https://discuss.elastic.co/t/best-way-to-drop-event-based-on-the-value-in-an-array-of-a-field/232883/3 "2020-06-12T21:32:35Z")

</div>

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