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 |
DISABLE_DYNAMIC_SCRIPTING_SETTING |
static ParseField |
KEY_SCRIPT_FILE |
static ParseField |
KEY_SCRIPT_ID |
static ParseField |
KEY_SCRIPT_INLINE |
static String |
SCRIPT_CACHE_EXPIRE_SETTING |
static String |
SCRIPT_CACHE_SIZE_SETTING |
static ParseField |
SCRIPT_FILE |
static ParseField |
SCRIPT_ID |
static String |
SCRIPT_INDEX |
static ParseField |
SCRIPT_INLINE |
static ParseField |
SCRIPT_LANG |
static ParseField |
VALUE_SCRIPT_FILE |
static ParseField |
VALUE_SCRIPT_ID |
static ParseField |
VALUE_SCRIPT_INLINE |
componentSettings, logger, settings
Constructor and Description |
---|
ScriptService(Settings settings,
Environment env,
Set<ScriptEngineService> scriptEngines,
ResourceWatcherService resourceWatcherService,
NodeSettingsService nodeSettingsService,
ScriptContextRegistry scriptContextRegistry) |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clear both the in memory and on disk compiled script caches.
|
void |
close() |
CompiledScript |
compile(String lang,
String scriptOrId,
ScriptService.ScriptType scriptType)
Deprecated.
use the method variant that accepts the
ScriptContext argument too: compile(String, String, ScriptType, ScriptContext) |
CompiledScript |
compile(String lang,
String script,
ScriptService.ScriptType scriptType,
ScriptContext scriptContext)
Checks if a script can be executed and compiles it if needed, or returns the previously compiled and cached script.
|
CompiledScript |
compileInternal(String lang,
String scriptOrId,
ScriptService.ScriptType scriptType)
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(String lang,
String script,
ScriptService.ScriptType scriptType,
Map<String,Object> vars)
Deprecated.
use the method variant that accepts the
ScriptContext argument too: executable(String, String, ScriptType, ScriptContext, Map) |
ExecutableScript |
executable(String lang,
String script,
ScriptService.ScriptType scriptType,
ScriptContext scriptContext,
Map<String,Object> vars)
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,
String lang,
String script,
ScriptService.ScriptType scriptType,
Map<String,Object> vars)
Deprecated.
use the method variant that accepts the
ScriptContext argument too: search(SearchLookup, String, String, ScriptType, ScriptContext, Map) |
SearchScript |
search(SearchLookup lookup,
String lang,
String script,
ScriptService.ScriptType scriptType,
ScriptContext scriptContext,
Map<String,Object> vars)
Compiles (or retrieves from cache) and executes the provided search script
|
void |
setClient(Client client) |
nodeName
public static final String DEFAULT_SCRIPTING_LANGUAGE_SETTING
public static final String DISABLE_DYNAMIC_SCRIPTING_SETTING
public static final String SCRIPT_CACHE_SIZE_SETTING
public static final String SCRIPT_CACHE_EXPIRE_SETTING
public static final String SCRIPT_INDEX
public static final String DEFAULT_LANG
public static final ParseField SCRIPT_LANG
public static final ParseField SCRIPT_FILE
public static final ParseField SCRIPT_ID
public static final ParseField SCRIPT_INLINE
public static final ParseField VALUE_SCRIPT_FILE
public static final ParseField VALUE_SCRIPT_ID
public static final ParseField VALUE_SCRIPT_INLINE
public static final ParseField KEY_SCRIPT_FILE
public static final ParseField KEY_SCRIPT_ID
public static final ParseField KEY_SCRIPT_INLINE
@Inject public ScriptService(Settings settings, Environment env, Set<ScriptEngineService> scriptEngines, ResourceWatcherService resourceWatcherService, NodeSettingsService nodeSettingsService, ScriptContextRegistry scriptContextRegistry) throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void clearCache()
@Deprecated public CompiledScript compile(String lang, String scriptOrId, ScriptService.ScriptType scriptType)
ScriptContext
argument too: compile(String, String, ScriptType, ScriptContext)
ScriptContext.Standard.GENERIC_PLUGIN
default context, assuming that it can only be called from plugins.public CompiledScript compile(String lang, String script, ScriptService.ScriptType scriptType, ScriptContext scriptContext)
public CompiledScript compileInternal(String lang, String scriptOrId, ScriptService.ScriptType scriptType)
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)
@Deprecated public ExecutableScript executable(String lang, String script, ScriptService.ScriptType scriptType, Map<String,Object> vars)
ScriptContext
argument too: executable(String, String, ScriptType, ScriptContext, Map)
ScriptContext.Standard.GENERIC_PLUGIN
default context, assuming that it can only be called from plugins.public ExecutableScript executable(String lang, String script, ScriptService.ScriptType scriptType, ScriptContext scriptContext, Map<String,Object> vars)
public ExecutableScript executable(CompiledScript compiledScript, Map<String,Object> vars)
@Deprecated public SearchScript search(SearchLookup lookup, String lang, String script, ScriptService.ScriptType scriptType, @Nullable Map<String,Object> vars)
ScriptContext
argument too: search(SearchLookup, String, String, ScriptType, ScriptContext, Map)
ScriptContext.Standard.GENERIC_PLUGIN
default context, assuming that it can only be called from plugins.public SearchScript search(SearchLookup lookup, String lang, String script, ScriptService.ScriptType scriptType, ScriptContext scriptContext, @Nullable Map<String,Object> vars)
Copyright © 2009–2016. All rights reserved.