# Conditional with a lot of or statements, is there a way to optimize the conditional?

**URL:** <https://discuss.elastic.co/t/conditional-with-a-lot-of-or-statements-is-there-a-way-to-optimize-the-conditional/208266>\
**Category:** Logstash\
**Created:** [November 18, 2019, 7:45am UTC](https://discuss.elastic.co/t/conditional-with-a-lot-of-or-statements-is-there-a-way-to-optimize-the-conditional/208266 "2019-11-18T07:45:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor.nilsson](https://avatars.discourse-cdn.com/v4/letter/v/eb8c5e/32.png) [@victor.nilsson](https://discuss.elastic.co/u/victor.nilsson)\
**Post date:** [November 18, 2019, 7:45am UTC](https://discuss.elastic.co/t/conditional-with-a-lot-of-or-statements-is-there-a-way-to-optimize-the-conditional/208266/1 "2019-11-18T07:45:42Z")

</div>

Hi,

We have a conditional in our pipeline where we check the value of a field against a list of 45+ values.  
We separate each value like this:

`if "AAA-5-AAA_AUTH_ADMIN_USER" in [ciscotag] OR "APF-4-INVALID_ENC_POL_SET" in [ciscotag]` etc...

Is there a way to list multiple values more effectively? Something like this perhaps:

```
if [ciscotag] == ("APF-4-INVALID_ENC_POL_SET"|"AAA-5-AAA_AUTH_ADMIN_USER"|"APF-6-RADIUS_OVERRIDE_DISABLED").

```

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:** [November 18, 2019, 2:24pm UTC](https://discuss.elastic.co/t/conditional-with-a-lot-of-or-statements-is-there-a-way-to-optimize-the-conditional/208266/2 "2019-11-18T14:24:23Z")

</div>

You could use a translate filter to test if a value exists in a hash.

---

<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:** [December 16, 2019, 2:24pm UTC](https://discuss.elastic.co/t/conditional-with-a-lot-of-or-statements-is-there-a-way-to-optimize-the-conditional/208266/3 "2019-12-16T14:24:30Z")

</div>

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