# How to add conditions in "Json Input"?

**URL:** https://discuss.elastic.co/t/how-to-add-conditions-in-json-input/151263
**Category:** Kibana
**Created:** [October 5, 2018, 5:36pm UTC](https://discuss.elastic.co/t/how-to-add-conditions-in-json-input/151263 "2018-10-05T17:36:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![vernal](https://avatars.discourse-cdn.com/v4/letter/v/b38774/32.png) [@vernal](https://discuss.elastic.co/u/vernal)
#### Post date: [October 5, 2018, 5:36pm UTC](https://discuss.elastic.co/t/how-to-add-conditions-in-json-input/151263/1 "2018-10-05T17:36:15Z")

</div>

I want to make a table based on some conditions. For example I have three variables a, b, and c.

If I want to create a table which only includes records that have a\>1 or b\<10 or 4\<c\<5. What should I do? What is the grammar I could use in "Json Input" or anything else?

Thanks in advance.

---

<div class="post-metadata">

### Author: ![Aaron\_Caldwell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron_caldwell/32/45755_2.png) [@Aaron\_Caldwell](https://discuss.elastic.co/u/Aaron_Caldwell)
#### Post date: [October 5, 2018, 7:22pm UTC](https://discuss.elastic.co/t/how-to-add-conditions-in-json-input/151263/2 "2018-10-05T19:22:07Z")

</div>

Hello Vernal,

If I'm understanding you correctly, you might want to check out scripted fields:

[https://www.elastic.co/guide/en/kibana/current/scripted-fields.html](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html)

The exact syntax will depend on which language you use!

Regards,  
Aaron

---

<div class="post-metadata">

### Author: ![vernal](https://avatars.discourse-cdn.com/v4/letter/v/b38774/32.png) [@vernal](https://discuss.elastic.co/u/vernal)
#### Post date: [October 5, 2018, 10:31pm UTC](https://discuss.elastic.co/t/how-to-add-conditions-in-json-input/151263/3 "2018-10-05T22:31:19Z")

</div>

Thanks Aaron! I want to create a plot for the variable satisfying the following condition: a\>1 or b \<10 or 4\<c\<5. I use "Painless" script to create three Scripted Fields for a, b and c. However, after I input the following script in the "script" box for the variable "C", I got compile error. Do you know what is wrong with it?

if(doc['c'].value\>4 or doc['c'].value\<5) return doc['c'].value

---

<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 2, 2018, 10:31pm UTC](https://discuss.elastic.co/t/how-to-add-conditions-in-json-input/151263/4 "2018-11-02T22:31:27Z")

</div>

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