# How to create scripted(String + painless) field in Kibana?

**URL:** <https://discuss.elastic.co/t/how-to-create-scripted-string-painless-field-in-kibana/90091>\
**Category:** Kibana\
**Created:** [June 20, 2017, 12:13pm UTC](https://discuss.elastic.co/t/how-to-create-scripted-string-painless-field-in-kibana/90091 "2017-06-20T12:13:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikas\_gopal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikas_gopal/32/47661_2.png) [@vikas\_gopal](https://discuss.elastic.co/u/vikas_gopal)\
**Post date:** [June 20, 2017, 12:13pm UTC](https://discuss.elastic.co/t/how-to-create-scripted-string-painless-field-in-kibana/90091/1 "2017-06-20T12:13:50Z")

</div>

Hi Kibana Experts,

I got a very simple requirement I need to achieve following  
\> if(doc["logSourceGroup"].value =="Palo Alto Firewall Group" OR doc["logSourceGroup"].value =="ASA Firewall"){return "Firewall";}  
\> else if (doc["logSourceGroup"].value =="Windows Server" OR doc["logSourceGroup"].value =="Linux Server"; ){return "OS";}

with above in Kibana I am getting an error that says Cannot support OR . Can someone provide some guidance what is the correct syntax to use multiple values with OR in ifelse statement .

Regards  
VG

---

<div class="post-metadata">

**Author:** ![vikas\_gopal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikas_gopal/32/47661_2.png) [@vikas\_gopal](https://discuss.elastic.co/u/vikas_gopal)\
**Post date:** [June 20, 2017, 12:22pm UTC](https://discuss.elastic.co/t/how-to-create-scripted-string-painless-field-in-kibana/90091/2 "2017-06-20T12:22:12Z")

</div>

I tried following as per documents  
`if (doc["logSourceGroup"].value =="Windows Server" || doc["logSourceGroup"].value == "Linux Server";){return "OS";}`

With above Kibana throws an error

![](https://us1.discourse-cdn.com/elastic/original/3X/6/d/6d905c76d9e63f9d46f5566cf559ddd1fa9a13cc.png)

---

<div class="post-metadata">

**Author:** ![raghvendra](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@raghvendra](https://discuss.elastic.co/u/raghvendra)\
**Post date:** [June 20, 2017, 12:27pm UTC](https://discuss.elastic.co/t/how-to-create-scripted-string-painless-field-in-kibana/90091/3 "2017-06-20T12:27:14Z")

</div>

Instead of -\> " (double quote ) use --\> ' (single quote) . It should help you.

---

<div class="post-metadata">

**Author:** ![vikas\_gopal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikas_gopal/32/47661_2.png) [@vikas\_gopal](https://discuss.elastic.co/u/vikas_gopal)\
**Post date:** [June 20, 2017, 12:35pm UTC](https://discuss.elastic.co/t/how-to-create-scripted-string-painless-field-in-kibana/90091/4 "2017-06-20T12:35:20Z")

</div>

Thankyou Singh,

I tried removing double quote with single but no luck .  
Actually problem was with extra ; I removed it and now it is working . So here is the actual syntax .

```
if (doc["logSourceGroup"].value == 'Windows Server' || doc["logSourceGroup"].value == 'Linux Server' || doc["logSourceGroup"].value == 'PCI-Devices'){return "OS";} else if(doc["logSourceGroup"].value == 'Palo Alto Firewall Group' || doc["logSourceGroup"].value == 'ASA Firewall'){return "Firewall";}

```

Hope it will help someone .

Cheers  
VG

---

<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 18, 2017, 12:35pm UTC](https://discuss.elastic.co/t/how-to-create-scripted-string-painless-field-in-kibana/90091/5 "2017-07-18T12:35:46Z")

</div>

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