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.StringALLOW_NONEstatic Setting<java.util.List<java.lang.String>>CONTEXTS_ALLOWED_SETTINGstatic Setting<TimeValue>SCRIPT_CACHE_EXPIRE_SETTINGstatic Setting<java.lang.Integer>SCRIPT_CACHE_SIZE_SETTINGstatic Setting<Tuple<java.lang.Integer,TimeValue>>SCRIPT_MAX_COMPILATIONS_RATEstatic Setting<java.lang.Integer>SCRIPT_MAX_SIZE_IN_BYTESstatic 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 voidapplyClusterState(ClusterChangedEvent event)Called when a new cluster state (ClusterChangedEvent.state()needs to be appliedvoidclose()<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(java.lang.String lang)booleanisTypeEnabled(ScriptType scriptType)voidputStoredScript(ClusterService clusterService, PutStoredScriptRequest request, ActionListener<AcknowledgedResponse> listener)ScriptStatsstats()
-
-
-
Field Detail
-
SCRIPT_CACHE_SIZE_SETTING
public static final Setting<java.lang.Integer> SCRIPT_CACHE_SIZE_SETTING
-
SCRIPT_MAX_SIZE_IN_BYTES
public static final Setting<java.lang.Integer> SCRIPT_MAX_SIZE_IN_BYTES
-
SCRIPT_MAX_COMPILATIONS_RATE
public static final Setting<Tuple<java.lang.Integer,TimeValue>> SCRIPT_MAX_COMPILATIONS_RATE
-
ALLOW_NONE
public static final java.lang.String ALLOW_NONE
- See Also:
- Constant Field Values
-
TYPES_ALLOWED_SETTING
public static final Setting<java.util.List<java.lang.String>> TYPES_ALLOWED_SETTING
-
CONTEXTS_ALLOWED_SETTING
public static final Setting<java.util.List<java.lang.String>> CONTEXTS_ALLOWED_SETTING
-
-
Constructor Detail
-
ScriptService
public ScriptService(Settings settings, java.util.Map<java.lang.String,ScriptEngine> engines, java.util.Map<java.lang.String,ScriptContext<?>> contexts)
-
-
Method Detail
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.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(java.lang.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- Specified by:
applyClusterStatein interfaceClusterStateApplier
-
-