# What is the correct format for a ternary operation in Kibana?

**URL:** <https://discuss.elastic.co/t/what-is-the-correct-format-for-a-ternary-operation-in-kibana/38509>\
**Category:** Kibana\
**Created:** [January 6, 2016, 12:51pm UTC](https://discuss.elastic.co/t/what-is-the-correct-format-for-a-ternary-operation-in-kibana/38509 "2016-01-06T12:51:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![KavyaS](https://avatars.discourse-cdn.com/v4/letter/k/838e76/32.png) [@KavyaS](https://discuss.elastic.co/u/KavyaS)\
**Post date:** [January 6, 2016, 12:51pm UTC](https://discuss.elastic.co/t/what-is-the-correct-format-for-a-ternary-operation-in-kibana/38509/1 "2016-01-06T12:51:32Z")

</div>

I want to separate the contents of a field named `ABCD` (contents are of string type) into 2 categories `Allowed` and `Blocked` using a ternary operation. I tried the following by adding it to scripted fields:

`doc['ABCD'].value=="CZ" OR doc['ABCD'].value=="GEO"? "Allowed": "Blocked"`

But Kibana says `Reset input and try again`. If i ignore it and move on it says `...Field [] used in expression must be numeric"}...`. It takes the type as numeric by default which cannot be changed. I chose format as string. How can i do the above operation? Please suggest if there is any other way as well.

---

<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:** [July 6, 2017, 2:05pm UTC](https://discuss.elastic.co/t/what-is-the-correct-format-for-a-ternary-operation-in-kibana/38509/2 "2017-07-06T14:05:41Z")

</div>


