Package org.elasticsearch.script
Enum Class ScriptType
- All Implemented Interfaces:
Serializable
,Comparable<ScriptType>
,Constable
,Writeable
ScriptType represents the way a script is stored and retrieved from the
ScriptService
.
It's also used to by ScriptService
to determine whether or not a Script
is
allowed to be executed based on both default and user-defined settings.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Enum Constant Summary
Enum ConstantDescriptionINLINE scripts are specified in numerous queries and compiled on-the-fly.STORED scripts are saved as part of theClusterState
based on user requests. -
Method Summary
Modifier and TypeMethodDescriptionint
getId()
getName()
org.elasticsearch.common.xcontent.ParseField
static ScriptType
readFrom(StreamInput in)
Reads an int from the input stream and converts it to aScriptType
.toString()
static ScriptType
Returns the enum constant of this class with the specified name.static ScriptType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.void
writeTo(StreamOutput out)
Write this into the StreamOutput.
-
Enum Constant Details
-
INLINE
INLINE scripts are specified in numerous queries and compiled on-the-fly. They will be cached based on the lang and code of the script. They are turned off by default because most languages are insecure (Groovy and others), but can be overridden by the specificScriptEngine
if the language is naturally secure (Painless, Mustache, and Expressions). -
STORED
STORED scripts are saved as part of theClusterState
based on user requests. They will be cached when they are first used in a query. They are turned off by default because most languages are insecure (Groovy and others), but can be overridden by the specificScriptEngine
if the language is naturally secure (Painless, Mustache, and Expressions).
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
readFrom
Reads an int from the input stream and converts it to aScriptType
.- Returns:
- The ScriptType read from the stream. Throws an
IllegalStateException
if no ScriptType is found based on the id. - Throws:
IOException
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
getId
public int getId()- Returns:
- The unique id for this
ScriptType
.
-
getName
- Returns:
- The unique name for this
ScriptType
based on theParseField
.
-
getParseField
public org.elasticsearch.common.xcontent.ParseField getParseField()- Returns:
- Specifies the name used to parse input from queries.
-
toString
- Overrides:
toString
in classEnum<ScriptType>
- Returns:
- The same as calling
getName()
.
-