Package org.elasticsearch.script
Class ScoreScript
java.lang.Object
org.elasticsearch.script.DocBasedScript
org.elasticsearch.script.ScoreScript
A script used for adjusting the score on a per document basis.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A helper to take in an explanation from a script and turn it into anExplanation
static interface
A factory to construct statefulScoreScript
factories for a specific index.static interface
A factory to constructScoreScript
instances. -
Field Summary
Modifier and TypeFieldDescriptionstatic final ScriptContext<ScoreScript.Factory>
static final String[]
Fields inherited from class org.elasticsearch.script.DocBasedScript
docReader
-
Constructor Summary
ConstructorDescriptionScoreScript
(Map<String, Object> params, SearchLookup searchLookup, DocReader docReader) -
Method Summary
Modifier and TypeMethodDescriptionint
Starting a name with underscore, so that the user cannot access this function directly through a script It is only used within predefined painless functions.int
Starting a name with underscore, so that the user cannot access this function directly through a script It is only used within predefined painless functions.Starting a name with underscore, so that the user cannot access this function directly through a script It is only used within predefined painless functions.int
Starting a name with underscore, so that the user cannot access this function directly through a script It is only used within predefined painless functions.void
_setIndexName
(String indexName) Starting a name with underscore, so that the user cannot access this function directly through a scriptvoid
_setShard
(int shardId) Starting a name with underscore, so that the user cannot access this function directly through a scriptabstract double
execute
(ScoreScript.ExplanationHolder explanation) double
Accessed as _score in the painless scriptReturn the parameters for this script.void
setDocument
(int docid) Set the current document to run the script on next.void
setScorer
(org.apache.lucene.search.Scorable scorer) Methods inherited from class org.elasticsearch.script.DocBasedScript
docAsMap, field, fields, getDoc
-
Field Details
-
PARAMETERS
-
CONTEXT
-
-
Constructor Details
-
ScoreScript
-
-
Method Details
-
execute
-
getParams
Return the parameters for this script. -
setDocument
public void setDocument(int docid) Set the current document to run the script on next.- Overrides:
setDocument
in classDocBasedScript
-
setScorer
public void setScorer(org.apache.lucene.search.Scorable scorer) -
get_score
public double get_score()Accessed as _score in the painless script- Returns:
- the score of the inner query
-
_getDocId
public int _getDocId()Starting a name with underscore, so that the user cannot access this function directly through a script It is only used within predefined painless functions.- Returns:
- the internal document ID
-
_getDocBaseId
public int _getDocBaseId()Starting a name with underscore, so that the user cannot access this function directly through a script It is only used within predefined painless functions.- Returns:
- the internal document ID with the base
-
_getShardId
public int _getShardId()Starting a name with underscore, so that the user cannot access this function directly through a script It is only used within predefined painless functions.- Returns:
- shard id or throws an exception if shard is not set up for this script instance
-
_getIndex
Starting a name with underscore, so that the user cannot access this function directly through a script It is only used within predefined painless functions.- Returns:
- index name or throws an exception if the index name is not set up for this script instance
-
_setShard
public void _setShard(int shardId) Starting a name with underscore, so that the user cannot access this function directly through a script -
_setIndexName
Starting a name with underscore, so that the user cannot access this function directly through a script
-