2018-07-02 17:44:36 -04:00
|
|
|
[[painless-contexts]]
|
|
|
|
== Painless contexts
|
|
|
|
|
|
|
|
A Painless script is evaluated within a context. Each context has values that
|
2020-06-16 14:43:22 -04:00
|
|
|
are available as local variables, an allowlist that controls the available
|
2018-07-02 17:44:36 -04:00
|
|
|
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.
|
|
|
|
|
|
|
|
[options="header",cols="<1,<1,<1"]
|
|
|
|
|====
|
|
|
|
| Name | Painless Documentation
|
|
|
|
| Elasticsearch Documentation
|
2018-08-09 17:24:55 -04:00
|
|
|
| Ingest processor | <<painless-ingest-processor-context, Painless Documentation>>
|
|
|
|
| {ref}/script-processor.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Update | <<painless-update-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/docs-update.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Update by query | <<painless-update-by-query-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/docs-update-by-query.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Reindex | <<painless-reindex-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/docs-reindex.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Sort | <<painless-sort-context, Painless Documentation>>
|
2020-07-23 13:44:47 -04:00
|
|
|
| {ref}/sort-search-results.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Similarity | <<painless-similarity-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/index-modules-similarity.html[Elasticsearch Documentation]
|
|
|
|
| Weight | <<painless-weight-context, Painless Documentation>>
|
|
|
|
| {ref}/index-modules-similarity.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Score | <<painless-score-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/query-dsl-function-score-query.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Field | <<painless-field-context, Painless Documentation>>
|
2020-08-06 13:06:06 -04:00
|
|
|
| {ref}/search-fields.html#script-fields[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Filter | <<painless-filter-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/query-dsl-script-query.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Minimum should match | <<painless-min-should-match-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/query-dsl-terms-set-query.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Metric aggregation initialization | <<painless-metric-agg-init-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Metric aggregation map | <<painless-metric-agg-map-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Metric aggregation combine | <<painless-metric-agg-combine-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Metric aggregation reduce | <<painless-metric-agg-reduce-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
|
2018-11-06 12:18:29 -05:00
|
|
|
| Bucket script aggregation | <<painless-bucket-script-agg-context, Painless Documentation>>
|
2018-07-25 13:59:25 -04:00
|
|
|
| {ref}/search-aggregations-pipeline-bucket-script-aggregation.html[Elasticsearch Documentation]
|
2018-11-08 11:02:30 -05:00
|
|
|
| Bucket selector aggregation | <<painless-bucket-selector-agg-context, Painless Documentation>>
|
|
|
|
| {ref}/search-aggregations-pipeline-bucket-selector-aggregation.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Watcher condition | <<painless-watcher-condition-context, Painless Documentation>>
|
2019-09-30 13:18:50 -04:00
|
|
|
| {ref}/condition-script.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
| Watcher transform | <<painless-watcher-transform-context, Painless Documentation>>
|
2019-09-30 13:18:50 -04:00
|
|
|
| {ref}/transform-script.html[Elasticsearch Documentation]
|
2018-07-02 17:44:36 -04:00
|
|
|
|====
|
|
|
|
|
|
|
|
include::painless-contexts/index.asciidoc[]
|