# Conditional if not working as expected

**URL:** <https://discuss.elastic.co/t/conditional-if-not-working-as-expected/378984>\
**Category:** Logstash\
**Created:** [June 8, 2025, 6:22pm UTC](https://discuss.elastic.co/t/conditional-if-not-working-as-expected/378984 "2025-06-08T18:22:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JJ192](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@JJ192](https://discuss.elastic.co/u/JJ192)\
**Post date:** [June 8, 2025, 6:22pm UTC](https://discuss.elastic.co/t/conditional-if-not-working-as-expected/378984/1 "2025-06-08T18:22:37Z")

</div>

Hello,

I am attempting to add a tag to certain lines imported from a CSV file, depending on "10" being present in the "state\_id" field. I am not getting any error messages but the output is creating two indexes with all data from the CSV, not just the data from those that should be tagged.

 ![ifasutria](https://us1.discourse-cdn.com/elastic/original/3X/f/b/fb042926437c075318125de687e56cd3a1212b9b.png)

I am very new to this so any input would be great!

Thanks!

---

<div class="post-metadata">

**Author:** ![dot-mike](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dot-mike/32/143339_2.png) [@dot-mike](https://discuss.elastic.co/u/dot-mike)\
**Post date:** [June 8, 2025, 8:30pm UTC](https://discuss.elastic.co/t/conditional-if-not-working-as-expected/378984/2 "2025-06-08T20:30:43Z")

</div>

Try without quotes on field filter:

```auto
if [state_id] == "10" { ... }

```
