How to add conditions in "Json Input"?


#1

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.


(Aaron Caldwell) #2

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

The exact syntax will depend on which language you use!

Regards,
Aaron


#3

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


(system) #4

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