# What if it is not an array after split?

**URL:** <https://discuss.elastic.co/t/what-if-it-is-not-an-array-after-split/152607>\
**Category:** Logstash\
**Created:** [October 16, 2018, 8:36am UTC](https://discuss.elastic.co/t/what-if-it-is-not-an-array-after-split/152607 "2018-10-16T08:36:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmkim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jmkim/32/37997_2.png) [@jmkim](https://discuss.elastic.co/u/jmkim)\
**Post date:** [October 16, 2018, 8:36am UTC](https://discuss.elastic.co/t/what-if-it-is-not-an-array-after-split/152607/1 "2018-10-16T08:36:14Z")

</div>

I want to treat an array as an if statement.

mutate {  
split =\> ["cookie\_ids", ";"]  
}  
**if [cookie\_ids][0] {**  
mutate {  
add\_field =\> ["cookie\_id", "%{cookie\_ids[0]}" ]  
}  
}  
else {  
mutate {  
add\_field =\> ["cookie\_id", "-"]  
}  
}

[2018-10-16T17:20:24,000][WARN][org.logstash.FieldReference] Detected ambiguous Field Reference `cookie_ids[0]`, which we expanded to the path `[cookie_ids, 0]`; in a future release of Logstash, ambiguous Field References will not be expanded.

---

<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:** [November 13, 2018, 8:38am UTC](https://discuss.elastic.co/t/what-if-it-is-not-an-array-after-split/152607/2 "2018-11-13T08:38:20Z")

</div>

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