Skip to content

Commit 765fcc3

Browse files
committed
Painless: Fix documentation links to use existing refs (#32335)
Uses ref and xpack-ref instead of custom ones in the Painless docs for long-term maintainability.
1 parent bf59c6d commit 765fcc3

19 files changed

+66
-69
lines changed
+19-22
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
[[painless-contexts]]
22
== Painless contexts
33

4-
:es_version: https://www.elastic.co/guide/en/elasticsearch/reference/master
5-
:xp_version: https://www.elastic.co/guide/en/x-pack/current
6-
74
A Painless script is evaluated within a context. Each context has values that
85
are available as local variables, a whitelist that controls the available
96
classes, and the methods and fields within those classes (API), and
@@ -18,41 +15,41 @@ specialized code may define new ways to use a Painless script.
1815
| Name | Painless Documentation
1916
| Elasticsearch Documentation
2017
| Update | <<painless-update-context, Painless Documentation>>
21-
| {es_version}/docs-update.html[Elasticsearch Documentation]
18+
| {ref}/docs-update.html[Elasticsearch Documentation]
2219
| Update by query | <<painless-update-by-query-context, Painless Documentation>>
23-
| {es_version}/docs-update-by-query.html[Elasticsearch Documentation]
20+
| {ref}/docs-update-by-query.html[Elasticsearch Documentation]
2421
| Reindex | <<painless-reindex-context, Painless Documentation>>
25-
| {es_version}/docs-reindex.html[Elasticsearch Documentation]
22+
| {ref}/docs-reindex.html[Elasticsearch Documentation]
2623
| Sort | <<painless-sort-context, Painless Documentation>>
27-
| {es_version}/search-request-sort.html[Elasticsearch Documentation]
24+
| {ref}/search-request-sort.html[Elasticsearch Documentation]
2825
| Similarity | <<painless-similarity-context, Painless Documentation>>
29-
| {es_version}/index-modules-similarity.html[Elasticsearch Documentation]
30-
| Weight | <<painless-similarity-context, Painless Documentation>>
31-
| {es_version}/index-modules-similarity.html[Elasticsearch Documentation]
26+
| {ref}/index-modules-similarity.html[Elasticsearch Documentation]
27+
| Weight | <<painless-weight-context, Painless Documentation>>
28+
| {ref}/index-modules-similarity.html[Elasticsearch Documentation]
3229
| Score | <<painless-score-context, Painless Documentation>>
33-
| {es_version}/query-dsl-function-score-query.html[Elasticsearch Documentation]
30+
| {ref}/query-dsl-function-score-query.html[Elasticsearch Documentation]
3431
| Field | <<painless-field-context, Painless Documentation>>
35-
| {es_version}/search-request-script-fields.html[Elasticsearch Documentation]
32+
| {ref}/search-request-script-fields.html[Elasticsearch Documentation]
3633
| Filter | <<painless-filter-context, Painless Documentation>>
37-
| {es_version}/query-dsl-script-query.html[Elasticsearch Documentation]
34+
| {ref}/query-dsl-script-query.html[Elasticsearch Documentation]
3835
| Minimum should match | <<painless-min-should-match-context, Painless Documentation>>
39-
| {es_version}/query-dsl-terms-set-query.html[Elasticsearch Documentation]
36+
| {ref}/query-dsl-terms-set-query.html[Elasticsearch Documentation]
4037
| Metric aggregation initialization | <<painless-metric-agg-init-context, Painless Documentation>>
41-
| {es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
38+
| {ref}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
4239
| Metric aggregation map | <<painless-metric-agg-map-context, Painless Documentation>>
43-
| {es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
40+
| {ref}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
4441
| Metric aggregation combine | <<painless-metric-agg-combine-context, Painless Documentation>>
45-
| {es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
42+
| {ref}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
4643
| Metric aggregation reduce | <<painless-metric-agg-reduce-context, Painless Documentation>>
47-
| {es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
44+
| {ref}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation]
4845
| Bucket aggregation | <<painless-bucket-agg-context, Painless Documentation>>
49-
| {es_version}/search-aggregations-pipeline-bucket-script-aggregation.html[Elasticsearch Documentation]
46+
| {ref}/search-aggregations-pipeline-bucket-script-aggregation.html[Elasticsearch Documentation]
5047
| Ingest processor | <<painless-ingest-processor-context, Painless Documentation>>
51-
| {es_version}/script-processor.html[Elasticsearch Documentation]
48+
| {ref}/script-processor.html[Elasticsearch Documentation]
5249
| Watcher condition | <<painless-watcher-condition-context, Painless Documentation>>
53-
| {xp_version}/condition-script.html[Elasticsearch Documentation]
50+
| {xpack-ref}/condition-script.html[Elasticsearch Documentation]
5451
| Watcher transform | <<painless-watcher-transform-context, Painless Documentation>>
55-
| {xp_version}/transform-script.html[Elasticsearch Documentation]
52+
| {xpack-ref}/transform-script.html[Elasticsearch Documentation]
5653
|====
5754

5855
include::painless-contexts/index.asciidoc[]

docs/painless/painless-contexts/painless-bucket-agg-context.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Bucket aggregation context
33

44
Use a Painless script in an
5-
{es_version}/search-aggregations-pipeline-bucket-script-aggregation.html[bucket aggregation]
5+
{ref}/search-aggregations-pipeline-bucket-script-aggregation.html[bucket aggregation]
66
to calculate a value as a result in a bucket.
77

88
*Variables*

docs/painless/painless-contexts/painless-field-context.asciidoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Field context
33

44
Use a Painless script to create a
5-
{es_version}/search-request-script-fields.html[script field] to return
5+
{ref}/search-request-script-fields.html[script field] to return
66
a customized value for each document in the results of a query.
77

88
*Variables*
@@ -14,7 +14,7 @@ a customized value for each document in the results of a query.
1414
Contains the fields of the specified document where each field is a
1515
`List` of values.
1616

17-
{es_version}/mapping-source-field.html[`ctx['_source']`] (`Map`)::
17+
{ref}/mapping-source-field.html[`ctx['_source']`] (`Map`)::
1818
Contains extracted JSON in a `Map` and `List` structure for the fields
1919
existing in a stored document.
2020

docs/painless/painless-contexts/painless-filter-context.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[[painless-filter-context]]
22
=== Filter context
33

4-
Use a Painless script as a {es_version}/query-dsl-script-query.html[filter] in a
4+
Use a Painless script as a {ref}/query-dsl-script-query.html[filter] in a
55
query to include and exclude documents.
66

77

docs/painless/painless-contexts/painless-ingest-processor-context.asciidoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[[painless-ingest-processor-context]]
22
=== Ingest processor context
33

4-
Use a Painless script in an {es_version}/script-processor.html[ingest processor]
4+
Use a Painless script in an {ref}/script-processor.html[ingest processor]
55
to modify documents upon insertion.
66

77
*Variables*
88

99
`params` (`Map`, read-only)::
1010
User-defined parameters passed in as part of the query.
1111

12-
{es_version}/mapping-index-field.html[`ctx['_index']`] (`String`)::
12+
{ref}/mapping-index-field.html[`ctx['_index']`] (`String`)::
1313
The name of the index.
1414

15-
{es_version}/mapping-type-field.html[`ctx['_type']`] (`String`)::
15+
{ref}/mapping-type-field.html[`ctx['_type']`] (`String`)::
1616
The type of document within an index.
1717

1818
`ctx` (`Map`)::
@@ -21,10 +21,10 @@ to modify documents upon insertion.
2121

2222
*Side Effects*
2323

24-
{es_version}/mapping-index-field.html[`ctx['_index']`]::
24+
{ref}/mapping-index-field.html[`ctx['_index']`]::
2525
Modify this to change the destination index for the current document.
2626

27-
{es_version}/mapping-type-field.html[`ctx['_type']`]::
27+
{ref}/mapping-type-field.html[`ctx['_type']`]::
2828
Modify this to change the type for the current document.
2929

3030
`ctx` (`Map`, read-only)::

docs/painless/painless-contexts/painless-metric-agg-combine-context.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Metric aggregation combine context
33

44
Use a Painless script to
5-
{es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[combine]
5+
{ref}/search-aggregations-metrics-scripted-metric-aggregation.html[combine]
66
values for use in a scripted metric aggregation. A combine script is run once
77
per shard following a <<painless-metric-agg-map-context, map script>> and is
88
optional as part of a full metric aggregation.

docs/painless/painless-contexts/painless-metric-agg-init-context.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Metric aggregation initialization context
33

44
Use a Painless script to
5-
{es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[initialize]
5+
{ref}/search-aggregations-metrics-scripted-metric-aggregation.html[initialize]
66
values for use in a scripted metric aggregation. An initialization script is
77
run prior to document collection once per shard and is optional as part of the
88
full metric aggregation.

docs/painless/painless-contexts/painless-metric-agg-map-context.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Metric aggregation map context
33

44
Use a Painless script to
5-
{es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[map]
5+
{ref}/search-aggregations-metrics-scripted-metric-aggregation.html[map]
66
values for use in a scripted metric aggregation. A map script is run once per
77
collected document following an optional
88
<<painless-metric-agg-init-context, initialization script>> and is required as

docs/painless/painless-contexts/painless-metric-agg-reduce-context.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Metric aggregation reduce context
33

44
Use a Painless script to
5-
{es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[reduce]
5+
{ref}/search-aggregations-metrics-scripted-metric-aggregation.html[reduce]
66
values to produce the result of a scripted metric aggregation. A reduce script
77
is run once on the coordinating node following a
88
<<painless-metric-agg-combine-context, combine script>> (or a

docs/painless/painless-contexts/painless-min-should-match-context.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Minimum should match context
33

44
Use a Painless script to specify the
5-
{es_version}/query-dsl-terms-set-query.html[minimum] number of terms that a
5+
{ref}/query-dsl-terms-set-query.html[minimum] number of terms that a
66
specified field needs to match with for a document to be part of the query
77
results.
88

docs/painless/painless-contexts/painless-reindex-context.asciidoc

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[[painless-reindex-context]]
22
=== Reindex context
33

4-
Use a Painless script in a {es_version}/docs-reindex.html[reindex] operation to
4+
Use a Painless script in a {ref}/docs-reindex.html[reindex] operation to
55
add, modify, or delete fields within each document in an original index as its
66
reindexed into a target index.
77

@@ -13,22 +13,22 @@ reindexed into a target index.
1313
`ctx['_op']` (`String`)::
1414
The name of the operation.
1515

16-
{es_version}/mapping-routing-field.html[`ctx['_routing']`] (`String`)::
16+
{ref}/mapping-routing-field.html[`ctx['_routing']`] (`String`)::
1717
The value used to select a shard for document storage.
1818

19-
{es_version}/mapping-index-field.html[`ctx['_index']`] (`String`)::
19+
{ref}/mapping-index-field.html[`ctx['_index']`] (`String`)::
2020
The name of the index.
2121

22-
{es_version}/mapping-type-field.html[`ctx['_type']`] (`String`)::
22+
{ref}/mapping-type-field.html[`ctx['_type']`] (`String`)::
2323
The type of document within an index.
2424

25-
{es_version}/mapping-id-field.html[`ctx['_id']`] (`int`, read-only)::
25+
{ref}/mapping-id-field.html[`ctx['_id']`] (`int`, read-only)::
2626
The unique document id.
2727

2828
`ctx['_version']` (`int`)::
2929
The current version of the document.
3030

31-
{es_version}/mapping-source-field.html[`ctx['_source']`] (`Map`)::
31+
{ref}/mapping-source-field.html[`ctx['_source']`] (`Map`)::
3232
Contains extracted JSON in a `Map` and `List` structure for the fields
3333
existing in a stored document.
3434

@@ -39,22 +39,22 @@ reindexed into a target index.
3939
specify no operation or `delete` to delete the current document from
4040
the index.
4141

42-
{es_version}/mapping-routing-field.html[`ctx['_routing']`]::
42+
{ref}/mapping-routing-field.html[`ctx['_routing']`]::
4343
Modify this to change the routing value for the current document.
4444

45-
{es_version}/mapping-index-field.html[`ctx['_index']`]::
45+
{ref}/mapping-index-field.html[`ctx['_index']`]::
4646
Modify this to change the destination index for the current document.
4747

48-
{es_version}/mapping-type-field.html[`ctx['_type']`]::
48+
{ref}/mapping-type-field.html[`ctx['_type']`]::
4949
Modify this to change the type for the current document.
5050

51-
{es_version}/mapping-id-field.html[`ctx['_id']`]::
51+
{ref}/mapping-id-field.html[`ctx['_id']`]::
5252
Modify this to change the id for the current document.
5353

5454
`ctx['_version']` (`int`)::
5555
Modify this to modify the version for the current document.
5656

57-
{es_version}/mapping-source-field.html[`ctx['_source']`]::
57+
{ref}/mapping-source-field.html[`ctx['_source']`]::
5858
Modify the values in the `Map/List` structure to add, modify, or delete
5959
the fields of a document.
6060

docs/painless/painless-contexts/painless-score-context.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Score context
33

44
Use a Painless script in a
5-
{es_version}/query-dsl-function-score-query.html[function score] to apply a new
5+
{ref}/query-dsl-function-score-query.html[function score] to apply a new
66
score to documents returned from a query.
77

88
*Variables*

docs/painless/painless-contexts/painless-similarity-context.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Similarity context
33

44
Use a Painless script to create a
5-
{es_version}/index-modules-similarity.html[similarity] equation for scoring
5+
{ref}/index-modules-similarity.html[similarity] equation for scoring
66
documents in a query.
77

88
*Variables*

docs/painless/painless-contexts/painless-sort-context.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Sort context
33

44
Use a Painless script to
5-
{es_version}/search-request-sort.html[sort] the documents in a query.
5+
{ref}/search-request-sort.html[sort] the documents in a query.
66

77
*Variables*
88

docs/painless/painless-contexts/painless-update-by-query-context.asciidoc

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Update by query context
33

44
Use a Painless script in an
5-
{es_version}/docs-update-by-query.html[update by query] operation to add,
5+
{ref}/docs-update-by-query.html[update by query] operation to add,
66
modify, or delete fields within each of a set of documents collected as the
77
result of query.
88

@@ -14,22 +14,22 @@ result of query.
1414
`ctx['_op']` (`String`)::
1515
The name of the operation.
1616

17-
{es_version}/mapping-routing-field.html[`ctx['_routing']`] (`String`, read-only)::
17+
{ref}/mapping-routing-field.html[`ctx['_routing']`] (`String`, read-only)::
1818
The value used to select a shard for document storage.
1919

20-
{es_version}/mapping-index-field.html[`ctx['_index']`] (`String`, read-only)::
20+
{ref}/mapping-index-field.html[`ctx['_index']`] (`String`, read-only)::
2121
The name of the index.
2222

23-
{es_version}/mapping-type-field.html[`ctx['_type']`] (`String`, read-only)::
23+
{ref}/mapping-type-field.html[`ctx['_type']`] (`String`, read-only)::
2424
The type of document within an index.
2525

26-
{es_version}/mapping-id-field.html[`ctx['_id']`] (`int`, read-only)::
26+
{ref}/mapping-id-field.html[`ctx['_id']`] (`int`, read-only)::
2727
The unique document id.
2828

2929
`ctx['_version']` (`int`, read-only)::
3030
The current version of the document.
3131

32-
{es_version}/mapping-source-field.html[`ctx['_source']`] (`Map`)::
32+
{ref}/mapping-source-field.html[`ctx['_source']`] (`Map`)::
3333
Contains extracted JSON in a `Map` and `List` structure for the fields
3434
existing in a stored document.
3535

@@ -40,7 +40,7 @@ result of query.
4040
specify no operation or `delete` to delete the current document from
4141
the index.
4242

43-
{es_version}/mapping-source-field.html[`ctx['_source']`]::
43+
{ref}/mapping-source-field.html[`ctx['_source']`]::
4444
Modify the values in the `Map/List` structure to add, modify, or delete
4545
the fields of a document.
4646

docs/painless/painless-contexts/painless-update-context.asciidoc

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[[painless-update-context]]
22
=== Update context
33

4-
Use a Painless script in an {es_version}/docs-update.html[update] operation to
4+
Use a Painless script in an {ref}/docs-update.html[update] operation to
55
add, modify, or delete fields within a single document.
66

77
*Variables*
@@ -12,16 +12,16 @@ add, modify, or delete fields within a single document.
1212
`ctx['_op']` (`String`)::
1313
The name of the operation.
1414

15-
{es_version}/mapping-routing-field.html[`ctx['_routing']`] (`String`, read-only)::
15+
{ref}/mapping-routing-field.html[`ctx['_routing']`] (`String`, read-only)::
1616
The value used to select a shard for document storage.
1717

18-
{es_version}/mapping-index-field.html[`ctx['_index']`] (`String`, read-only)::
18+
{ref}/mapping-index-field.html[`ctx['_index']`] (`String`, read-only)::
1919
The name of the index.
2020

21-
{es_version}/mapping-type-field.html[`ctx['_type']`] (`String`, read-only)::
21+
{ref}/mapping-type-field.html[`ctx['_type']`] (`String`, read-only)::
2222
The type of document within an index.
2323

24-
{es_version}/mapping-id-field.html[`ctx['_id']`] (`int`, read-only)::
24+
{ref}/mapping-id-field.html[`ctx['_id']`] (`int`, read-only)::
2525
The unique document id.
2626

2727
`ctx['_version']` (`int`, read-only)::
@@ -30,7 +30,7 @@ add, modify, or delete fields within a single document.
3030
`ctx['_now']` (`long`, read-only)::
3131
The current timestamp in milliseconds.
3232

33-
{es_version}/mapping-source-field.html[`ctx['_source']`] (`Map`)::
33+
{ref}/mapping-source-field.html[`ctx['_source']`] (`Map`)::
3434
Contains extracted JSON in a `Map` and `List` structure for the fields
3535
existing in a stored document.
3636

@@ -41,7 +41,7 @@ add, modify, or delete fields within a single document.
4141
specify no operation or `delete` to delete the current document from
4242
the index.
4343

44-
{es_version}/mapping-source-field.html[`ctx['_source']`]::
44+
{ref}/mapping-source-field.html[`ctx['_source']`]::
4545
Modify the values in the `Map/List` structure to add, modify, or delete
4646
the fields of a document.
4747

docs/painless/painless-contexts/painless-watcher-condition-context.asciidoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[[painless-watcher-condition-context]]
22
=== Watcher condition context
33

4-
Use a Painless script as a {xp_version}/condition-script.html[watcher condition]
4+
Use a Painless script as a {xpack-ref}/condition-script.html[watcher condition]
55
to test if a response is necessary.
66

77
*Variables*
@@ -26,7 +26,7 @@ to test if a response is necessary.
2626

2727
`ctx['payload']` (`Map`, read-only)::
2828
The accessible watch data based upon the
29-
{xp_version}/input.html[watch input].
29+
{xpack-ref}/input.html[watch input].
3030

3131
*Return*
3232

0 commit comments

Comments
 (0)