Package org.elasticsearch.script
Class ScriptService
java.lang.Object
org.elasticsearch.script.ScriptService
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,ClusterStateApplier
public class ScriptService extends java.lang.Object implements java.io.Closeable, ClusterStateApplier
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALLOW_NONE
static Setting<java.util.List<java.lang.String>>
CONTEXTS_ALLOWED_SETTING
static Setting<TimeValue>
SCRIPT_CACHE_EXPIRE_SETTING
static Setting<java.lang.Integer>
SCRIPT_CACHE_SIZE_SETTING
static Setting<Tuple<java.lang.Integer,TimeValue>>
SCRIPT_MAX_COMPILATIONS_RATE
static Setting<java.lang.Integer>
SCRIPT_MAX_SIZE_IN_BYTES
static Setting<java.util.List<java.lang.String>>
TYPES_ALLOWED_SETTING
-
Constructor Summary
Constructors Constructor Description ScriptService(Settings settings, java.util.Map<java.lang.String,ScriptEngine> engines, java.util.Map<java.lang.String,ScriptContext<?>> contexts)
-
Method Summary
Modifier and Type Method Description void
applyClusterState(ClusterChangedEvent event)
Called when a new cluster state (ClusterChangedEvent.state()
needs to be applied.void
close()
<FactoryType>
FactoryTypecompile(Script script, ScriptContext<FactoryType> context)
Compiles a script using the given context.void
deleteStoredScript(ClusterService clusterService, DeleteStoredScriptRequest request, ActionListener<AcknowledgedResponse> listener)
java.util.Set<ScriptContextInfo>
getContextInfos()
ScriptLanguagesInfo
getScriptLanguages()
StoredScriptSource
getStoredScript(ClusterState state, GetStoredScriptRequest request)
boolean
isAnyContextEnabled()
boolean
isContextEnabled(ScriptContext scriptContext)
boolean
isLangSupported(java.lang.String lang)
boolean
isTypeEnabled(ScriptType scriptType)
void
putStoredScript(ClusterService clusterService, PutStoredScriptRequest request, ActionListener<AcknowledgedResponse> listener)
ScriptStats
stats()
-
Field Details
-
SCRIPT_CACHE_SIZE_SETTING
-
SCRIPT_CACHE_EXPIRE_SETTING
-
SCRIPT_MAX_SIZE_IN_BYTES
-
SCRIPT_MAX_COMPILATIONS_RATE
-
ALLOW_NONE
public static final java.lang.String ALLOW_NONE- See Also:
- Constant Field Values
-
TYPES_ALLOWED_SETTING
-
CONTEXTS_ALLOWED_SETTING
-
-
Constructor Details
-
ScriptService
public ScriptService(Settings settings, java.util.Map<java.lang.String,ScriptEngine> engines, java.util.Map<java.lang.String,ScriptContext<?>> contexts)
-
-
Method Details
-
close
public void close() throws java.io.IOException- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
compile
Compiles a script using the given context.- Returns:
- a compiled script which may be used to construct instances of a script for the given context
-
isLangSupported
public boolean isLangSupported(java.lang.String lang) -
isTypeEnabled
-
isContextEnabled
-
isAnyContextEnabled
public boolean isAnyContextEnabled() -
putStoredScript
public void putStoredScript(ClusterService clusterService, PutStoredScriptRequest request, ActionListener<AcknowledgedResponse> listener) -
deleteStoredScript
public void deleteStoredScript(ClusterService clusterService, DeleteStoredScriptRequest request, ActionListener<AcknowledgedResponse> listener) -
getStoredScript
-
getContextInfos
-
getScriptLanguages
-
stats
-
applyClusterState
Description copied from interface:ClusterStateApplier
Called when a new cluster state (ClusterChangedEvent.state()
needs to be applied. The cluster state to be applied is already committed when this method is called, so an applier must therefore be prepared to deal with any state it receives without throwing an exception. Throwing an exception from an applier is very bad because it will stop the application of this state before it has reached all the other appliers, and will likely result in another attempt to apply the same (or very similar) cluster state which might continue until this node is removed from the cluster.- Specified by:
applyClusterState
in interfaceClusterStateApplier
-