Module org.elasticsearch.server
Class CreateIndexRequest
java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.AbstractTransportRequest
org.elasticsearch.action.ActionRequest
org.elasticsearch.action.LegacyActionRequest
org.elasticsearch.action.support.master.MasterNodeRequest<CreateIndexRequest>
org.elasticsearch.action.support.master.AcknowledgedRequest<CreateIndexRequest>
org.elasticsearch.action.admin.indices.create.CreateIndexRequest
- All Implemented Interfaces:
IndicesRequest,Writeable,RefCounted,TaskAwareRequest,TransportRequest
public class CreateIndexRequest
extends AcknowledgedRequest<CreateIndexRequest>
implements IndicesRequest
A request to create an index.
The index created can optionally be created with settings(org.elasticsearch.common.settings.Settings).
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.action.support.master.AcknowledgedRequest
AcknowledgedRequest.PlainNested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.RemoteClusterShardRequest, IndicesRequest.Replaceable, IndicesRequest.SingleIndexNoWildcardsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ParseFieldstatic final Stringstatic final ParseFieldstatic final ParseFieldFields inherited from class org.elasticsearch.action.support.master.AcknowledgedRequest
DEFAULT_ACK_TIMEOUTFields inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
INFINITE_MASTER_NODE_TIMEOUT, TRAPPY_IMPLICIT_DEFAULT_MASTER_NODE_TIMEOUTFields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCED -
Constructor Summary
ConstructorsConstructorDescriptionCreateIndexRequest(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(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.booleaninthashCode()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.initializeFailureStore(boolean initializeFailureStore) Set whether this CreateIndexRequest should initialize the failure store on data stream creation.booleanReturns whether the failure store should be initialized.booleanSet the mapping for this index The mapping should be in the form of a JSON string, with an outer _doc keySet the mapping for this indexmapping(XContentBuilder source) Set the mapping for this indexmappings()origin()requireDataStream(boolean requireDataStream) Set whether this CreateIndexRequest requires a data stream.settings()The settings to create the index with.settings(String source, XContentType xContentType) 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(XContentBuilder builder) Allows to set the settings using a json builder.simpleMapping(String... source) A specialized simplified mapping source method, takes the form of simple properties definition: ("field1", "type=string,store=true").source(byte[] source, int offset, int length, XContentType xContentType) Sets the settings and mappings as a single source.source(byte[] source, XContentType xContentType) Sets the settings and mappings as a single source.source(String source, XContentType xContentType) Sets the settings and mappings as a single source.source(Map<String, ?> source, DeprecationHandler deprecationHandler) Sets the settings and mappings as a single source.source(BytesReference source, XContentType xContentType) Sets the settings and mappings as a single source.source(XContentBuilder source) Sets the settings and mappings as a single source.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.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class org.elasticsearch.action.support.master.AcknowledgedRequest
ackTimeout, ackTimeoutMethods inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
masterNodeTimeout, masterNodeTimeout, masterTermMethods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResultMethods inherited from class org.elasticsearch.transport.AbstractTransportRequest
getParentTask, getRequestId, remoteAddress, remoteAddress, setParentTask, setRequestId, toStringMethods inherited from class org.elasticsearch.transport.TransportMessage
decRef, hasReferences, incRef, tryIncRefMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.action.IndicesRequest
includeDataStreamsMethods inherited from interface org.elasticsearch.core.RefCounted
decRef, hasReferences, incRef, mustIncRef, tryIncRefMethods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
createTask, createTask, getDescription, setParentTask
-
Field Details
-
MAPPINGS
-
SETTINGS
-
ALIASES
-
EMPTY_MAPPINGS
- See Also:
-
-
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
- Overrides:
validatein classAcknowledgedRequest<CreateIndexRequest>
-
indices
Description copied from interface:IndicesRequestReturns the array of indices that the action relates to- Specified by:
indicesin interfaceIndicesRequest
-
indicesOptions
Description copied from interface:IndicesRequestReturns 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:
indicesOptionsin 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
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
Set the mapping for this index The mapping should be in the form of a JSON string, with an outer _doc key.mapping("{\"_doc\":{\"properties\": ... }}") -
mapping
Set the mapping for this index- Parameters:
source- The mapping source
-
mapping
Set the mapping for this index- Parameters:
source- The mapping source
-
simpleMapping
A specialized simplified mapping source method, takes the form of simple properties definition: ("field1", "type=string,store=true"). -
cause
The cause for this index creation. -
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
Sets the settings and mappings as a single source. -
source
Sets the settings and mappings as a single source. -
source
Sets the settings and mappings as a single source. -
source
Sets the settings and mappings as a single source. -
source
Sets the settings and mappings as a single source. -
source
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.ALLto 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. -
isRequireDataStream
public boolean isRequireDataStream() -
requireDataStream
Set whether this CreateIndexRequest requires a data stream. The data stream may be pre-existing or to-be-created. -
isInitializeFailureStore
public boolean isInitializeFailureStore()Returns whether the failure store should be initialized. N.B. If true, failure store index creation will be performed regardless of whether the template indicates that the failure store is enabled. -
initializeFailureStore
Set whether this CreateIndexRequest should initialize the failure store on data stream creation. This can be necessary when, for example, a failure occurs while trying to ingest a document into a data stream that has to be auto-created. N.B. If true, failure store index creation will be performed regardless of whether the template indicates that the failure store is enabled. It is the caller's responsibility to ensure that this is correct. -
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classAcknowledgedRequest<CreateIndexRequest>- Throws:
IOException
-
equals
-
hashCode
public int hashCode()
-