- Painless Scripting Language: other versions:
- Painless Guide
- Painless Language Specification
- Painless contexts
- Context example data
- Runtime fields context
- Ingest processor context
- Update context
- Update by query context
- Reindex context
- Sort context
- Similarity context
- Weight context
- Score context
- Field context
- Filter context
- Minimum should match context
- Metric aggregation initialization context
- Metric aggregation map context
- Metric aggregation combine context
- Metric aggregation reduce context
- Bucket script aggregation context
- Bucket selector aggregation context
- Analysis Predicate Context
- Watcher condition context
- Watcher transform context
- Painless API Reference
- Shared API
- Aggregation Selector API
- Aggs API
- Aggs Combine API
- Aggs Init API
- Aggs Map API
- Aggs Reduce API
- Analysis API
- Bucket Aggregation API
- Field API
- Filter API
- Ingest API
- Interval API
- Moving Function API
- Number Sort API
- Painless Test API
- Processor Conditional API
- Score API
- Script Heuristic API
- Similarity API
- Similarity Weight API
- String Sort API
- Template API
- Terms Set API
- Update API
- Watcher Condition API
- Watcher Transform API
- Xpack Template API
IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Metric aggregation map context
editMetric aggregation map context
editUse a Painless script to map values for use in a scripted metric aggregation. A map script is run once per collected document following an optional initialization script and is required as part of a full metric aggregation.
Variables
-
params
(Map
, read-only) - User-defined parameters passed in as part of the query.
-
state
(Map
) -
Map
used to add values for processing in a combine script or to be returned from the aggregation. -
doc
(Map
, read-only) -
Contains the fields of the current document where each field is a
List
of values. -
_score
(double
read-only) - The similarity score of the current document.
Side Effects
-
state
(Map
) -
Use this
Map
to add values for processing in a combine script. Additional values must be of the typeMap
,List
,String
or primitive. The samestate
Map
is shared between all aggregated documents on a given shard. If an initialization script is provided as part of the aggregation then values added from the initialization script are available. If no combine script is specified, values must be directly stored instate
in a usable form. If no combine script and no reduce script are specified, thestate
values are used as the result.
Return
-
void
- No expected return value.
API
The standard Painless API is available.
Was this helpful?
Thank you for your feedback.