Painless contexts

edit

A Painless script is evaluated within a context. Each context has values that are available as local variables, an allowlist that controls the available classes, and the methods and fields within those classes (API), and if and what type of value is returned.

Painless scripts typically run within one of the contexts in the following table. Before using a Painless context, configure the example data. Each context example is configured to operate on this data.