public class ScriptService extends AbstractComponent implements java.io.Closeable
Modifier and Type | Class and Description |
---|---|
static class |
ScriptService.ScriptType
The type of a script, more specifically where it gets loaded from:
- provided dynamically at request time
- loaded from an index
- loaded from file
|
Modifier and Type | Field and Description |
---|---|
static Setting<java.lang.Boolean> |
SCRIPT_AUTO_RELOAD_ENABLED_SETTING |
static Setting<TimeValue> |
SCRIPT_CACHE_EXPIRE_SETTING |
static Setting<java.lang.Integer> |
SCRIPT_CACHE_SIZE_SETTING |
static ParseField |
SCRIPT_FILE
Deprecated.
Use
ScriptService.ScriptType.getParseField() instead. This should
be removed in 2.0 |
static ParseField |
SCRIPT_ID
Deprecated.
Use
ScriptService.ScriptType.getParseField() instead. This should
be removed in 2.0 |
static java.lang.String |
SCRIPT_INDEX |
static ParseField |
SCRIPT_INLINE
Deprecated.
Use
ScriptService.ScriptType.getParseField() instead. This should
be removed in 2.0 |
static ParseField |
SCRIPT_LANG
Deprecated.
Use
Script.ScriptField instead. This should be removed in
2.0 |
deprecationLogger, logger, settings
Constructor and Description |
---|
ScriptService(Settings settings,
Environment env,
java.util.Set<ScriptEngineService> scriptEngines,
ResourceWatcherService resourceWatcherService,
ScriptEngineRegistry scriptEngineRegistry,
ScriptContextRegistry scriptContextRegistry,
ScriptSettings scriptSettings) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
CompiledScript |
compile(Script script,
ScriptContext scriptContext,
java.util.Map<java.lang.String,java.lang.String> params)
Checks if a script can be executed and compiles it if needed, or returns the previously compiled and cached script.
|
CompiledScript |
compileInternal(Script script,
java.util.Map<java.lang.String,java.lang.String> params)
Compiles a script straight-away, or returns the previously compiled and cached script,
without checking if it can be executed based on settings.
|
void |
deleteScriptFromIndex(DeleteIndexedScriptRequest request,
ActionListener<DeleteResponse> listener) |
ExecutableScript |
executable(CompiledScript compiledScript,
java.util.Map<java.lang.String,java.lang.Object> vars)
Executes a previously compiled script provided as an argument
|
ExecutableScript |
executable(Script script,
ScriptContext scriptContext,
java.util.Map<java.lang.String,java.lang.String> params)
Compiles (or retrieves from cache) and executes the provided script
|
Client |
getClient() |
static java.lang.String |
getScriptFromResponse(GetResponse responseFields) |
void |
putScriptToIndex(PutIndexedScriptRequest request,
ActionListener<IndexResponse> listener) |
void |
queryScriptIndex(GetIndexedScriptRequest request,
ActionListener<GetResponse> listener) |
SearchScript |
search(SearchLookup lookup,
Script script,
ScriptContext scriptContext,
java.util.Map<java.lang.String,java.lang.String> params)
Compiles (or retrieves from cache) and executes the provided search script
|
void |
setClient(Client client) |
ScriptStats |
stats() |
logDeprecatedSetting, logRemovedSetting, nodeName
public static final Setting<java.lang.Integer> SCRIPT_CACHE_SIZE_SETTING
public static final java.lang.String SCRIPT_INDEX
public static final Setting<java.lang.Boolean> SCRIPT_AUTO_RELOAD_ENABLED_SETTING
@Deprecated public static final ParseField SCRIPT_LANG
Script.ScriptField
instead. This should be removed in
2.0@Deprecated public static final ParseField SCRIPT_FILE
ScriptService.ScriptType.getParseField()
instead. This should
be removed in 2.0@Deprecated public static final ParseField SCRIPT_ID
ScriptService.ScriptType.getParseField()
instead. This should
be removed in 2.0@Deprecated public static final ParseField SCRIPT_INLINE
ScriptService.ScriptType.getParseField()
instead. This should
be removed in 2.0@Inject public ScriptService(Settings settings, Environment env, java.util.Set<ScriptEngineService> scriptEngines, ResourceWatcherService resourceWatcherService, ScriptEngineRegistry scriptEngineRegistry, ScriptContextRegistry scriptContextRegistry, ScriptSettings scriptSettings) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public CompiledScript compile(Script script, ScriptContext scriptContext, java.util.Map<java.lang.String,java.lang.String> params)
public CompiledScript compileInternal(Script script, java.util.Map<java.lang.String,java.lang.String> params)
public void queryScriptIndex(GetIndexedScriptRequest request, ActionListener<GetResponse> listener)
public void putScriptToIndex(PutIndexedScriptRequest request, ActionListener<IndexResponse> listener)
public void deleteScriptFromIndex(DeleteIndexedScriptRequest request, ActionListener<DeleteResponse> listener)
public static java.lang.String getScriptFromResponse(GetResponse responseFields)
public ExecutableScript executable(Script script, ScriptContext scriptContext, java.util.Map<java.lang.String,java.lang.String> params)
public ExecutableScript executable(CompiledScript compiledScript, java.util.Map<java.lang.String,java.lang.Object> vars)
public SearchScript search(SearchLookup lookup, Script script, ScriptContext scriptContext, java.util.Map<java.lang.String,java.lang.String> params)
public ScriptStats stats()
public Client getClient()