Package org.elasticsearch.script
Class ScriptService
- java.lang.Object
-
- org.elasticsearch.script.ScriptService
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ClusterStateApplier
public class ScriptService extends Object implements Closeable, ClusterStateApplier
-
-
Field Summary
Fields Modifier and Type Field Description static StringALLOW_NONEstatic Setting<List<String>>CONTEXTS_ALLOWED_SETTINGstatic Setting<TimeValue>SCRIPT_CACHE_EXPIRE_SETTINGstatic Setting<Integer>SCRIPT_CACHE_SIZE_SETTINGstatic Setting<Tuple<Integer,TimeValue>>SCRIPT_MAX_COMPILATIONS_RATEstatic Setting<Integer>SCRIPT_MAX_SIZE_IN_BYTESstatic Setting<List<String>>TYPES_ALLOWED_SETTING
-
Constructor Summary
Constructors Constructor Description ScriptService(Settings settings, Map<String,ScriptEngine> engines, Map<String,ScriptContext<?>> contexts)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyClusterState(ClusterChangedEvent event)Called when a new cluster state (ClusterChangedEvent.state()needs to be applied.voidclose()<FactoryType>
FactoryTypecompile(Script script, ScriptContext<FactoryType> context)Compiles a script using the given context.voiddeleteStoredScript(ClusterService clusterService, DeleteStoredScriptRequest request, ActionListener<AcknowledgedResponse> listener)StoredScriptSourcegetStoredScript(ClusterState state, GetStoredScriptRequest request)booleanisAnyContextEnabled()booleanisContextEnabled(ScriptContext scriptContext)booleanisLangSupported(String lang)booleanisTypeEnabled(ScriptType scriptType)voidputStoredScript(ClusterService clusterService, PutStoredScriptRequest request, ActionListener<AcknowledgedResponse> listener)ScriptStatsstats()
-
-
-
Constructor Detail
-
ScriptService
public ScriptService(Settings settings, Map<String,ScriptEngine> engines, Map<String,ScriptContext<?>> contexts)
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
compile
public <FactoryType> FactoryType compile(Script script, ScriptContext<FactoryType> context)
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(String lang)
-
isTypeEnabled
public boolean isTypeEnabled(ScriptType scriptType)
-
isContextEnabled
public boolean isContextEnabled(ScriptContext scriptContext)
-
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
public StoredScriptSource getStoredScript(ClusterState state, GetStoredScriptRequest request)
-
stats
public ScriptStats stats()
-
applyClusterState
public void applyClusterState(ClusterChangedEvent event)
Description copied from interface:ClusterStateApplierCalled 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:
applyClusterStatein interfaceClusterStateApplier
-
-