public class ScriptService extends AbstractComponent implements 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 String |
DEFAULT_LANG |
static String |
DEFAULT_SCRIPTING_LANGUAGE_SETTING |
static String |
SCRIPT_AUTO_RELOAD_ENABLED_SETTING |
static String |
SCRIPT_CACHE_EXPIRE_SETTING |
static int |
SCRIPT_CACHE_SIZE_DEFAULT |
static String |
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 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,
Set<ScriptEngineService> scriptEngines,
ResourceWatcherService resourceWatcherService,
ScriptContextRegistry scriptContextRegistry) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
CompiledScript |
compile(Script script,
ScriptContext scriptContext,
HasContextAndHeaders headersContext,
Map<String,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,
HasContextAndHeaders context,
Map<String,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,
Map<String,Object> vars)
Executes a previously compiled script provided as an argument
|
ExecutableScript |
executable(Script script,
ScriptContext scriptContext,
HasContextAndHeaders headersContext,
Map<String,String> params)
Compiles (or retrieves from cache) and executes the provided script
|
static 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,
Map<String,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 String DEFAULT_SCRIPTING_LANGUAGE_SETTING
public static final String SCRIPT_CACHE_SIZE_SETTING
public static final int SCRIPT_CACHE_SIZE_DEFAULT
public static final String SCRIPT_CACHE_EXPIRE_SETTING
public static final String SCRIPT_INDEX
public static final String DEFAULT_LANG
public static final String 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, Set<ScriptEngineService> scriptEngines, ResourceWatcherService resourceWatcherService, ScriptContextRegistry scriptContextRegistry) throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public CompiledScript compile(Script script, ScriptContext scriptContext, HasContextAndHeaders headersContext, Map<String,String> params)
public CompiledScript compileInternal(Script script, HasContextAndHeaders context, Map<String,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 String getScriptFromResponse(GetResponse responseFields)
public ExecutableScript executable(Script script, ScriptContext scriptContext, HasContextAndHeaders headersContext, Map<String,String> params)
public ExecutableScript executable(CompiledScript compiledScript, Map<String,Object> vars)
public SearchScript search(SearchLookup lookup, Script script, ScriptContext scriptContext, Map<String,String> params)
public ScriptStats stats()
Copyright © 2009–2016. All rights reserved.