Class CreateIndexRequest
java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.TransportRequest
org.elasticsearch.action.ActionRequest
org.elasticsearch.action.support.master.MasterNodeRequest<Request>
org.elasticsearch.action.support.master.AcknowledgedRequest<CreateIndexRequest>
org.elasticsearch.action.admin.indices.create.CreateIndexRequest
- All Implemented Interfaces:
IndicesRequest
,AckedRequest
,Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentObject
,org.elasticsearch.core.RefCounted
,TaskAwareRequest
public class CreateIndexRequest
extends AcknowledgedRequest<CreateIndexRequest>
implements IndicesRequest, org.elasticsearch.common.xcontent.ToXContentObject
A request to create an index. Best created with
Requests.createIndexRequest(String)
.
The index created can optionally be created with settings(org.elasticsearch.common.settings.Settings)
.
-
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
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
Fields inherited from class org.elasticsearch.action.support.master.AcknowledgedRequest
DEFAULT_ACK_TIMEOUT, timeout
Fields inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
DEFAULT_MASTER_NODE_TIMEOUT, masterNodeTimeout
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionCreateIndexRequest(String index)
Constructs a request to create an index.CreateIndexRequest(String index, Settings settings)
Constructs a request to create an index.Constructs a new request by deserializing an input -
Method Summary
Modifier and TypeMethodDescriptionAdds an alias that will be associated with the index when it gets createdaliases()
Sets the aliases that will be associated with the index when it gets createdSets the aliases that will be associated with the index when it gets createdaliases(BytesReference source)
Sets the aliases that will be associated with the index when it gets createdaliases(org.elasticsearch.common.xcontent.XContentBuilder source)
Sets the aliases that will be associated with the index when it gets createdcause()
The cause for this index creation.The cause for this index creation.boolean
int
hashCode()
index()
The index name to create.String[]
indices()
Returns the array of indices that the action relates toReturns the indices options used to resolve indices.org.elasticsearch.common.xcontent.XContentBuilder
innerToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
A specialized simplified mapping source method, takes the form of simple properties definition: ("field1", "type=string,store=true").Adds mapping that will be added when the index gets created.Adds mapping that will be added when the index gets created.Adds mapping that will be added when the index gets created.mappings()
origin()
settings()
The settings to create the index with.The settings to create the index with (either json or yaml format)The settings to create the index with (either json/yaml/properties format)The settings to create the index with.settings(Settings.Builder settings)
The settings to create the index with.settings(org.elasticsearch.common.xcontent.XContentBuilder builder)
Allows to set the settings using a json builder.source(byte[] source, int offset, int length, org.elasticsearch.common.xcontent.XContentType xContentType)
Sets the settings and mappings as a single source.source(byte[] source, org.elasticsearch.common.xcontent.XContentType xContentType)
Sets the settings and mappings as a single source.Sets the settings and mappings as a single source.source(Map<String,?> source, org.elasticsearch.common.xcontent.DeprecationHandler deprecationHandler)
Sets the settings and mappings as a single source.source(BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)
Sets the settings and mappings as a single source.source(org.elasticsearch.common.xcontent.XContentBuilder source)
Sets the settings and mappings as a single source.org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
validate()
waitForActiveShards(int waitForActiveShards)
A shortcut forwaitForActiveShards(ActiveShardCount)
where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)
to get the ActiveShardCount.waitForActiveShards(ActiveShardCount waitForActiveShards)
Sets the number of shard copies that should be active for index creation to return.void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class org.elasticsearch.action.support.master.AcknowledgedRequest
ackTimeout, timeout, timeout, timeout
Methods inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
masterNodeTimeout, masterNodeTimeout, masterNodeTimeout
Methods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResult
Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTask, toString
Methods inherited from class org.elasticsearch.transport.TransportMessage
decRef, incRef, remoteAddress, remoteAddress, tryIncRef
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.cluster.ack.AckedRequest
masterNodeTimeout
Methods inherited from interface org.elasticsearch.action.IndicesRequest
allowsRemoteIndices, includeDataStreams
Methods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
createTask, getDescription, setParentTask
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
Field Details
-
MAPPINGS
public static final org.elasticsearch.common.xcontent.ParseField MAPPINGS -
SETTINGS
public static final org.elasticsearch.common.xcontent.ParseField SETTINGS -
ALIASES
public static final org.elasticsearch.common.xcontent.ParseField ALIASES
-
-
Constructor Details
-
CreateIndexRequest
Constructs a new request by deserializing an input- Parameters:
in
- the input from which to deserialize- Throws:
IOException
-
CreateIndexRequest
public CreateIndexRequest() -
CreateIndexRequest
Constructs a request to create an index.- Parameters:
index
- the name of the index
-
CreateIndexRequest
Constructs a request to create an index.- Parameters:
index
- the name of the indexsettings
- the settings to apply to the index
-
-
Method Details
-
validate
- Specified by:
validate
in classActionRequest
-
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
-
index
The index name to create. -
index
-
settings
The settings to create the index with. -
cause
The cause for this index creation. -
origin
-
origin
-
settings
The settings to create the index with. -
settings
The settings to create the index with. -
settings
public CreateIndexRequest settings(String source, org.elasticsearch.common.xcontent.XContentType xContentType)The settings to create the index with (either json or yaml format) -
settings
Allows to set the settings using a json builder. -
settings
The settings to create the index with (either json/yaml/properties format) -
mapping
public CreateIndexRequest mapping(String type, String source, org.elasticsearch.common.xcontent.XContentType xContentType)Adds mapping that will be added when the index gets created.- Parameters:
type
- The mapping typesource
- The mapping sourcexContentType
- The content type of the source
-
cause
The cause for this index creation. -
mapping
public CreateIndexRequest mapping(String type, org.elasticsearch.common.xcontent.XContentBuilder source)Adds mapping that will be added when the index gets created.- Parameters:
type
- The mapping typesource
- The mapping source
-
mapping
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"). -
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 associated with the index when it gets created -
source
public CreateIndexRequest source(String source, org.elasticsearch.common.xcontent.XContentType xContentType)Sets the settings and mappings as a single source. -
source
Sets the settings and mappings as a single source. -
source
public CreateIndexRequest source(byte[] source, org.elasticsearch.common.xcontent.XContentType xContentType)Sets the settings and mappings as a single source. -
source
public CreateIndexRequest source(byte[] source, int offset, int length, org.elasticsearch.common.xcontent.XContentType xContentType)Sets the settings and mappings as a single source. -
source
public CreateIndexRequest source(BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)Sets the settings and mappings as a single source. -
source
public CreateIndexRequest source(Map<String,?> source, org.elasticsearch.common.xcontent.DeprecationHandler deprecationHandler)Sets the settings and mappings as a single source. -
mappings
-
aliases
-
waitForActiveShards
-
waitForActiveShards
Sets the number of shard copies that should be active for index creation to return. Defaults toActiveShardCount.DEFAULT
, which will wait for one shard copy (the primary) to become active. Set this value toActiveShardCount.ALL
to wait for all shards (primary and all replicas) to be active before returning. Otherwise, useActiveShardCount.from(int)
to set this value to any non-negative integer, up to the number of copies per shard (number of replicas + 1), to wait for the desired amount of shard copies to become active before returning. Index creation will only wait up until the timeout value for the number of shard copies to be active before returning. CheckShardsAcknowledgedResponse.isShardsAcknowledged()
to determine if the requisite shard copies were all started before returning or timing out.- Parameters:
waitForActiveShards
- number of active shard copies to wait on
-
waitForActiveShards
A shortcut forwaitForActiveShards(ActiveShardCount)
where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)
to get the ActiveShardCount. -
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Overrides:
writeTo
in classAcknowledgedRequest<CreateIndexRequest>
- Throws:
IOException
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
IOException
-
innerToXContent
public org.elasticsearch.common.xcontent.XContentBuilder innerToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Throws:
IOException
-
equals
-
hashCode
public int hashCode()
-