Package org.elasticsearch.script
Class ScoreScript
- java.lang.Object
-
- org.elasticsearch.script.ScoreScript
-
public abstract class ScoreScript extends Object
A script used for adjusting the score on a per document basis.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classScoreScript.ExplanationHolderA helper to take in an explanation from a script and turn it into anExplanationstatic interfaceScoreScript.FactoryA factory to construct statefulScoreScriptfactories for a specific index.static interfaceScoreScript.LeafFactoryA factory to constructScoreScriptinstances.
-
Field Summary
Fields Modifier and Type Field Description static ScriptContext<ScoreScript.Factory>CONTEXTstatic String[]PARAMETERS
-
Constructor Summary
Constructors Constructor Description ScoreScript(Map<String,Object> params, SearchLookup lookup, LeafReaderContext leafContext)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.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.String_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.Version_getIndexVersion()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_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.void_setIndexName(String indexName)Starting a name with underscore, so that the user cannot access this function directly through a scriptvoid_setIndexVersion(Version indexVersion)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 doubleexecute(ScoreScript.ExplanationHolder explanation)doubleget_score()Accessed as _score in the painless scriptMap<String,ScriptDocValues<?>>getDoc()The doc lookup for the Lucene segment this script was created for.Map<String,Object>getParams()Return the parameters for this script.voidsetDocument(int docid)Set the current document to run the script on next.voidsetScorer(Scorable scorer)
-
-
-
Field Detail
-
PARAMETERS
public static final String[] PARAMETERS
-
CONTEXT
public static final ScriptContext<ScoreScript.Factory> CONTEXT
-
-
Constructor Detail
-
ScoreScript
public ScoreScript(Map<String,Object> params, SearchLookup lookup, LeafReaderContext leafContext)
-
-
Method Detail
-
execute
public abstract double execute(ScoreScript.ExplanationHolder explanation)
-
getDoc
public final Map<String,ScriptDocValues<?>> getDoc()
The doc lookup for the Lucene segment this script was created for.
-
setDocument
public void setDocument(int docid)
Set the current document to run the script on next.
-
setScorer
public void setScorer(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
public String _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
-
_getIndexVersion
public Version _getIndexVersion()
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 version or throws an exception if the index version 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
public void _setIndexName(String indexName)
Starting a name with underscore, so that the user cannot access this function directly through a script
-
_setIndexVersion
public void _setIndexVersion(Version indexVersion)
Starting a name with underscore, so that the user cannot access this function directly through a script
-
-