Skip to content

Commit 19c84b9

Browse files
rationullrjernst
authored andcommitted
Update scripted metric docs to use state variable (#32695)
This change brings the scripted metric agg context docs in line with the new agg state context variable.
1 parent 1ad1ff9 commit 19c84b9

4 files changed

+12
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ optional as part of a full metric aggregation.
1212
`params` (`Map`, read-only)::
1313
User-defined parameters passed in as part of the query.
1414

15-
`params['_agg']` (`Map`)::
15+
`state` (`Map`)::
1616
`Map` with values available from the prior map script.
1717

1818
*Return*

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ full metric aggregation.
1212
`params` (`Map`, read-only)::
1313
User-defined parameters passed in as part of the query.
1414

15-
`params['_agg']` (`Map`)::
15+
`state` (`Map`)::
1616
Empty `Map` used to add values for use in a
1717
<<painless-metric-agg-map-context, map script>>.
1818

1919
*Side Effects*
2020

21-
`params['_agg']` (`Map`)::
21+
`state` (`Map`)::
2222
Add values to this `Map` to for use in a map. Additional values must
2323
be of the type `Map`, `List`, `String` or primitive.
2424

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ part of a full metric aggregation.
1313
`params` (`Map`, read-only)::
1414
User-defined parameters passed in as part of the query.
1515

16-
`params['_agg']` (`Map`)::
16+
`state` (`Map`)::
1717
`Map` used to add values for processing in a
18-
<<painless-metric-agg-map-context, combine script>> or returned
19-
directly.
18+
<<painless-metric-agg-map-context, combine script>> or to be returned from the aggregation.
2019

2120
`doc` (`Map`, read-only)::
2221
Contains the fields of the current document where each field is a
@@ -27,15 +26,16 @@ part of a full metric aggregation.
2726

2827
*Side Effects*
2928

30-
`params['_agg']` (`Map`)::
29+
`state` (`Map`)::
3130
Use this `Map` to add values for processing in a combine script.
3231
Additional values must be of the type `Map`, `List`, `String` or
33-
primitive. If an initialization script is provided as part the
32+
primitive. The same `state` `Map` is shared between all aggregated documents
33+
on a given shard. If an initialization script is provided as part of the
3434
aggregation then values added from the initialization script are
35-
available as well. If no combine script is specified, values must be
36-
directly stored in `_agg`. If no combine script and no
35+
available. If no combine script is specified, values must be
36+
directly stored in `state` in a usable form. If no combine script and no
3737
<<painless-metric-agg-reduce-context, reduce script>> are specified, the
38-
values are used as the result.
38+
`state` values are used as the result.
3939

4040
*Return*
4141

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ specified) and is optional as part of a full metric aggregation.
1414
`params` (`Map`, read-only)::
1515
User-defined parameters passed in as part of the query.
1616

17-
`params['_aggs']` (`Map`)::
17+
`states` (`Map`)::
1818
`Map` with values available from the prior combine script (or a map
1919
script if no combine script is specified).
2020

0 commit comments

Comments
 (0)