- 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.
Weight context
editWeight context
editUse a Painless script to create a weight for use in a similarity script. The weight makes up the part of the similarity calculation that is independent of the document being scored, and so can be built up front and cached.
Queries that contain multiple terms calculate a separate weight for each term.
Variables
-
query.boost
(float
, read-only) -
The boost value if provided by the query. If this is not provided the
value is
1.0f
. -
field.docCount
(long
, read-only) - The number of documents that have a value for the current field.
-
field.sumDocFreq
(long
, read-only) -
The sum of all terms that exist for the current field. If this is not
available the value is
-1
. -
field.sumTotalTermFreq
(long
, read-only) -
The sum of occurrences in the index for all the terms that exist in the
current field. If this is not available the value is
-1
. -
term.docFreq
(long
, read-only) - The number of documents that contain the current term in the index.
-
term.totalTermFreq
(long
, read-only) - The total occurrences of the current term in the index.
Return
-
double
- A scoring factor used across all documents.
API
The standard Painless API is available.
ElasticON events are back!
Learn about the Elastic Search AI Platform from the experts at our live events.
Register nowWas this helpful?
Thank you for your feedback.