Can if conditions be performed on scripted fields in Kibana painless?
For example, I have a scripted field "TAT" which is the difference in 2 times to return turn around time in minutes. I want to see values for TAT > 90 minutes but I am unable to do so even in the filter section or as a scripted field on TAT.
Filter: TAT.keyword >= 90
Scripted Field Attempt:
if(doc['TAT.keyword'].value>90) {return "High"}
For both, it says TAT does not exist or TAT.Keyword does not exist. TAT is a scripted field as well. Thanks
If I am not mistaken, referencing a scripted field inside another will most likely fail as there is no priority in computing the scripted fields so you don't always have the field present when trying to compute the other one.
Why don't you move both calculations inside one single scripted field?
Yes I can do that, I was only wondering with this approach each time I need to perform an operation on the TAT, I would need to include the calculations for TAT rather than use TAT like any other field. But since you mention, that it may not be possible to use a scripted field inside another, I'll take the calculations approach. Thanks!!
This sounds like a good use case for runtime fields, which was added in 7.11. They are scripted fields that act like real fields, which means that they can be referenced by another runtime field.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.