Hi. Our team made a scripted field for time difference called "time". We have a new use case where if the value in "time" is greater than 8hours, it will return as 'Yes' and if not 'No'. The value for 'time' is set to minutes. The script below kept returning 'Yes' even if 'time' is less than 8hours. Are we going in the right direction? Thanks.
So time is a scripted field itself? If that's the case, you can't use it within another scripted field as they can't reference each other. If you want to use the same logic, you have to copy it over. That's probably also why the new scripted field is always returning Yes - the time field is never available because it's not in the original document the scripted field has access to.
This is implementing what you said about copying over the logic instead of using the scripted field "time". On the preview, there was no error but there are no results as well. The preview came back with:
Hi @flash1293. We tried saving the scripted field even if the preview shows
[]
The script works properly in Discover and in other visualizations we tried it on. I guess there's a bug on painless? We are using Kibana 7.6.2. Thank you.
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.