Consistent now access in scripting #77199
Labels
:Core/Infra/Scripting
Scripting abstractions, Painless, and Mustache
>enhancement
Team:Core/Infra
Meta label for core/infra team
We discourage users from using
now
in painless. However,now
is a supported time in range queries and date range aggs.Painless exposes Java methods such as System.currentTimeMillis() but the return values from those API calls will not be consistent across executions in the same request.
A consistent view of time is available in
SearchExecutionContext.nowInMillis()
but, importantly, that API ensures the results are not cached.We should provide a way for users to use a consistent version of
now
in painless while ensuring it works with percolator and correctly caches scripts.The text was updated successfully, but these errors were encountered: