Field dynamics kibana Painless

hello, can you help me?
I have a field containing the time of a possible solution to a demand and I would like to create a dynamic field that counts how much time is left to overflow type:
''' now() - doc['forecast'].value '''
in second

Hi @francieliton_araujo. now() is not available in Painless because now() creates a different time for every field. Our documentation suggests passing a now parameter to the script. But the value for that parameter must be generated outside of the query. So I don't think it's possible to do what you are asking.

Are you trying to create a visualization? Maybe we can find some other way to accomplish this without a runtime field. For example, Kibana v8.9 (coming soon) adds support for (among other things) a now() function for Lens formulas.

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