A Painless script is evaluated within a context. Each context has values that are available as local variables, a whitelist that controls the available classes, and the methods and fields within those classes (API), and if and what type of value is returned.
A Painless script is typically executed within one of the contexts in the table below. Note this is not necessarily a comprehensive list as custom plugins and specialized code may define new ways to use a Painless script.
|Name||Painless Documentation||Elasticsearch Documentation|
Update by query
Minimum should match
Metric aggregation initialization
Metric aggregation map
Metric aggregation combine
Metric aggregation reduce
Bucket script aggregation
Bucket selector aggregation