Class PutIndexTemplateRequest
java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.TransportRequest
org.elasticsearch.action.ActionRequest
org.elasticsearch.action.support.master.MasterNodeRequest<PutIndexTemplateRequest>
org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest
- All Implemented Interfaces:
IndicesRequest
,Writeable
,ToXContent
,ToXContentObject
,TaskAwareRequest
public class PutIndexTemplateRequest extends MasterNodeRequest<PutIndexTemplateRequest> implements IndicesRequest, ToXContentObject
A request to create an index template.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportRequest
TransportRequest.Empty
Nested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.Replaceable
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
DEFAULT_MASTER_NODE_TIMEOUT, masterNodeTimeout
-
Constructor Summary
Constructors Constructor Description PutIndexTemplateRequest()
PutIndexTemplateRequest(java.lang.String name)
Constructs a new put index template request with the provided name.PutIndexTemplateRequest(StreamInput in)
-
Method Summary
Modifier and Type Method Description PutIndexTemplateRequest
alias(Alias alias)
Adds an alias that will be added when the index gets created.java.util.Set<Alias>
aliases()
PutIndexTemplateRequest
aliases(java.lang.String source)
Sets the aliases that will be associated with the index when it gets createdPutIndexTemplateRequest
aliases(java.util.Map<java.lang.String,?> source)
Sets the aliases that will be associated with the index when it gets createdPutIndexTemplateRequest
aliases(BytesReference source)
Sets the aliases that will be associated with the index when it gets createdPutIndexTemplateRequest
aliases(XContentBuilder source)
Sets the aliases that will be associated with the index when it gets createdjava.lang.String
cause()
PutIndexTemplateRequest
cause(java.lang.String cause)
The cause for this index template creation.boolean
create()
PutIndexTemplateRequest
create(boolean create)
Set totrue
to force only creation, not an update of an index template.java.lang.String[]
indices()
Returns the array of indices that the action relates toIndicesOptions
indicesOptions()
Returns the indices options used to resolve indices.PutIndexTemplateRequest
mapping(java.lang.String type, java.lang.Object... source)
A specialized simplified mapping source method, takes the form of simple properties definition: ("field1", "type=string,store=true").PutIndexTemplateRequest
mapping(java.lang.String type, java.lang.String source, XContentType xContentType)
Adds mapping that will be added when the index gets created.PutIndexTemplateRequest
mapping(java.lang.String type, java.util.Map<java.lang.String,java.lang.Object> source)
Adds mapping that will be added when the index gets created.PutIndexTemplateRequest
mapping(java.lang.String type, BytesReference source, XContentType xContentType)
Adds mapping that will be added when the index gets created.PutIndexTemplateRequest
mapping(java.lang.String type, XContentBuilder source)
Adds mapping that will be added when the index gets created.java.util.Map<java.lang.String,java.lang.String>
mappings()
java.lang.String
name()
The name of the index template.PutIndexTemplateRequest
name(java.lang.String name)
Sets the name of the index template.int
order()
PutIndexTemplateRequest
order(int order)
java.util.List<java.lang.String>
patterns()
PutIndexTemplateRequest
patterns(java.util.List<java.lang.String> indexPatterns)
Settings
settings()
PutIndexTemplateRequest
settings(java.lang.String source, XContentType xContentType)
The settings to create the index template with (either json/yaml format).PutIndexTemplateRequest
settings(java.util.Map<java.lang.String,java.lang.Object> source)
The settings to create the index template with (either json or yaml format).PutIndexTemplateRequest
settings(Settings settings)
The settings to create the index template with.PutIndexTemplateRequest
settings(Settings.Builder settings)
The settings to create the index template with.PutIndexTemplateRequest
source(byte[] source, int offset, int length, XContentType xContentType)
The template source definition.PutIndexTemplateRequest
source(byte[] source, XContentType xContentType)
The template source definition.PutIndexTemplateRequest
source(java.lang.String templateSource, XContentType xContentType)
The template source definition.PutIndexTemplateRequest
source(java.util.Map<java.lang.String,java.lang.Object> templateSource)
The template source definition.PutIndexTemplateRequest
source(BytesReference source, XContentType xContentType)
The template source definition.PutIndexTemplateRequest
source(XContentBuilder templateBuilder)
The template source definition.XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
ActionRequestValidationException
validate()
java.lang.Integer
version()
PutIndexTemplateRequest
version(java.lang.Integer version)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
masterNodeTimeout, masterNodeTimeout, masterNodeTimeout
Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTask
Methods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
createTask, getDescription, setParentTask
-
Constructor Details
-
PutIndexTemplateRequest
- Throws:
java.io.IOException
-
PutIndexTemplateRequest
public PutIndexTemplateRequest() -
PutIndexTemplateRequest
public PutIndexTemplateRequest(java.lang.String name)Constructs a new put index template request with the provided name.
-
-
Method Details
-
validate
- Specified by:
validate
in classActionRequest
-
name
Sets the name of the index template. -
name
public java.lang.String name()The name of the index template. -
patterns
-
patterns
public java.util.List<java.lang.String> patterns() -
order
-
order
public int order() -
version
-
version
public java.lang.Integer version() -
create
Set totrue
to force only creation, not an update of an index template. If it already exists, it will fail with anIllegalArgumentException
. -
create
public boolean create() -
settings
The settings to create the index template with. -
settings
The settings to create the index template with. -
settings
The settings to create the index template with (either json/yaml format). -
settings
The settings to create the index template with (either json or yaml format). -
settings
-
mapping
public PutIndexTemplateRequest mapping(java.lang.String type, java.lang.String source, XContentType xContentType)Adds mapping that will be added when the index gets created.- Parameters:
type
- The mapping typesource
- The mapping sourcexContentType
- The type of content contained within the source
-
cause
The cause for this index template creation. -
cause
public java.lang.String cause() -
mapping
Adds mapping that will be added when the index gets created.- Parameters:
type
- The mapping typesource
- The mapping source
-
mapping
public PutIndexTemplateRequest mapping(java.lang.String type, BytesReference source, XContentType xContentType)Adds mapping that will be added when the index gets created.- Parameters:
type
- The mapping typesource
- The mapping sourcexContentType
- the source content type
-
mapping
public PutIndexTemplateRequest mapping(java.lang.String type, java.util.Map<java.lang.String,java.lang.Object> source)Adds mapping that will be added when the index gets created.- Parameters:
type
- The mapping typesource
- The mapping source
-
mapping
A specialized simplified mapping source method, takes the form of simple properties definition: ("field1", "type=string,store=true"). -
mappings
public java.util.Map<java.lang.String,java.lang.String> mappings() -
source
The template source definition. -
source
public PutIndexTemplateRequest source(java.util.Map<java.lang.String,java.lang.Object> templateSource)The template source definition. -
source
The template source definition. -
source
The template source definition. -
source
public PutIndexTemplateRequest source(byte[] source, int offset, int length, XContentType xContentType)The template source definition. -
source
The template source definition. -
aliases
-
aliases
Sets the aliases that will be associated with the index when it gets created -
aliases
Sets the aliases that will be associated with the index when it gets created -
aliases
Sets the aliases that will be associated with the index when it gets created -
aliases
Sets the aliases that will be associated with the index when it gets created -
alias
Adds an alias that will be added when the index gets created.- Parameters:
alias
- The metadata for the new alias- Returns:
- the index template creation request
-
indices
public java.lang.String[] indices()Description copied from interface:IndicesRequest
Returns the array of indices that the action relates to- Specified by:
indices
in interfaceIndicesRequest
-
indicesOptions
Description copied from interface:IndicesRequest
Returns the indices options used to resolve indices. They tell for instance whether a single index is accepted, whether an empty array will be converted to _all, and how wildcards will be expanded if needed.- Specified by:
indicesOptions
in interfaceIndicesRequest
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Overrides:
writeTo
in classMasterNodeRequest<PutIndexTemplateRequest>
- Throws:
java.io.IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-