public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest> implements IndicesRequest
Requests.createIndexRequest(String)
.
The index created can optionally be created with settings(org.elasticsearch.common.settings.Settings)
.
TransportRequest.Empty
IndicesRequest.Replaceable
DEFAULT_ACK_TIMEOUT, timeout
DEFAULT_MASTER_NODE_TIMEOUT, masterNodeTimeout
Constructor and Description |
---|
CreateIndexRequest() |
CreateIndexRequest(java.lang.String index)
Constructs a new request to create an index with the specified name.
|
CreateIndexRequest(java.lang.String index,
Settings settings)
Constructs a new request to create an index with the specified name and settings.
|
Modifier and Type | Method and Description |
---|---|
CreateIndexRequest |
alias(Alias alias)
Adds an alias that will be associated with the index when it gets created
|
java.util.Set<Alias> |
aliases() |
CreateIndexRequest |
aliases(BytesReference source)
Sets the aliases that will be associated with the index when it gets created
|
CreateIndexRequest |
aliases(java.util.Map source)
Sets the aliases that will be associated with the index when it gets created
|
CreateIndexRequest |
aliases(java.lang.String source)
Sets the aliases that will be associated with the index when it gets created
|
CreateIndexRequest |
aliases(XContentBuilder source)
Sets the aliases that will be associated with the index when it gets created
|
java.lang.String |
cause()
The cause for this index creation.
|
CreateIndexRequest |
cause(java.lang.String cause)
The cause for this index creation.
|
CreateIndexRequest |
custom(IndexMetaData.Custom custom)
Adds custom metadata to the index to be created.
|
java.util.Map<java.lang.String,IndexMetaData.Custom> |
customs() |
java.lang.String |
index()
The index name to create.
|
CreateIndexRequest |
index(java.lang.String index) |
java.lang.String[] |
indices()
Returns the array of indices that the action relates to
|
IndicesOptions |
indicesOptions()
Returns the indices options used to resolve indices.
|
CreateIndexRequest |
mapping(java.lang.String type,
java.util.Map source)
Adds mapping that will be added when the index gets created.
|
CreateIndexRequest |
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").
|
CreateIndexRequest |
mapping(java.lang.String type,
java.lang.String source)
Deprecated.
use
mapping(String, String, XContentType) to avoid content type detection |
CreateIndexRequest |
mapping(java.lang.String type,
java.lang.String source,
XContentType xContentType)
Adds mapping that will be added when the index gets created.
|
CreateIndexRequest |
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() |
void |
readFrom(StreamInput in)
Set this object's fields from a StreamInput.
|
Settings |
settings()
The settings to create the index with.
|
CreateIndexRequest |
settings(java.util.Map source)
The settings to create the index with (either json/yaml/properties format)
|
CreateIndexRequest |
settings(java.lang.Object... settings)
A simplified version of settings that takes key value pairs settings.
|
CreateIndexRequest |
settings(Settings.Builder settings)
The settings to create the index with.
|
CreateIndexRequest |
settings(Settings settings)
The settings to create the index with.
|
CreateIndexRequest |
settings(java.lang.String source)
Deprecated.
use
source(String, XContentType) instead to avoid content type detection |
CreateIndexRequest |
settings(java.lang.String source,
XContentType xContentType)
The settings to create the index with (either json or yaml format)
|
CreateIndexRequest |
settings(XContentBuilder builder)
Allows to set the settings using a json builder.
|
CreateIndexRequest |
source(byte[] source)
Deprecated.
|
CreateIndexRequest |
source(byte[] source,
int offset,
int length)
Deprecated.
|
CreateIndexRequest |
source(byte[] source,
int offset,
int length,
XContentType xContentType)
Sets the settings and mappings as a single source.
|
CreateIndexRequest |
source(byte[] source,
XContentType xContentType)
Sets the settings and mappings as a single source.
|
CreateIndexRequest |
source(BytesReference source)
Deprecated.
|
CreateIndexRequest |
source(BytesReference source,
XContentType xContentType)
Sets the settings and mappings as a single source.
|
CreateIndexRequest |
source(java.util.Map<java.lang.String,?> source)
Sets the settings and mappings as a single source.
|
CreateIndexRequest |
source(java.lang.String source)
Deprecated.
|
CreateIndexRequest |
source(java.lang.String source,
XContentType xContentType)
Sets the settings and mappings as a single source.
|
CreateIndexRequest |
source(XContentBuilder source)
Sets the settings and mappings as a single source.
|
boolean |
updateAllTypes()
True if all fields that span multiple types should be updated, false otherwise
|
CreateIndexRequest |
updateAllTypes(boolean updateAllTypes)
See
updateAllTypes() |
ActionRequestValidationException |
validate() |
ActiveShardCount |
waitForActiveShards() |
CreateIndexRequest |
waitForActiveShards(ActiveShardCount waitForActiveShards)
Sets the number of shard copies that should be active for index creation to return.
|
CreateIndexRequest |
waitForActiveShards(int waitForActiveShards)
A shortcut for
waitForActiveShards(ActiveShardCount) where the numerical
shard count is passed in, instead of having to first call ActiveShardCount.from(int)
to get the ActiveShardCount. |
void |
writeTo(StreamOutput out)
Write this object's fields to a StreamOutput.
|
ackTimeout, readTimeout, timeout, timeout, timeout, writeTimeout
masterNodeTimeout, masterNodeTimeout, masterNodeTimeout
getShouldStoreResult
getParentTask, setParentTask
remoteAddress, remoteAddress
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
masterNodeTimeout
createTask, getDescription, setParentTask
public CreateIndexRequest()
public CreateIndexRequest(java.lang.String index)
public CreateIndexRequest(java.lang.String index, Settings settings)
public ActionRequestValidationException validate()
validate
in class ActionRequest
public java.lang.String[] indices()
IndicesRequest
indices
in interface IndicesRequest
public IndicesOptions indicesOptions()
IndicesRequest
indicesOptions
in interface IndicesRequest
public java.lang.String index()
public CreateIndexRequest index(java.lang.String index)
public Settings settings()
public java.lang.String cause()
public CreateIndexRequest settings(java.lang.Object... settings)
public CreateIndexRequest settings(Settings settings)
public CreateIndexRequest settings(Settings.Builder settings)
@Deprecated public CreateIndexRequest settings(java.lang.String source)
source(String, XContentType)
instead to avoid content type detectionpublic CreateIndexRequest settings(java.lang.String source, XContentType xContentType)
public CreateIndexRequest settings(XContentBuilder builder)
public CreateIndexRequest settings(java.util.Map source)
@Deprecated public CreateIndexRequest mapping(java.lang.String type, java.lang.String source)
mapping(String, String, XContentType)
to avoid content type detectiontype
- The mapping typesource
- The mapping sourcepublic CreateIndexRequest mapping(java.lang.String type, java.lang.String source, XContentType xContentType)
type
- The mapping typesource
- The mapping sourcexContentType
- The content type of the sourcepublic CreateIndexRequest cause(java.lang.String cause)
public CreateIndexRequest mapping(java.lang.String type, XContentBuilder source)
type
- The mapping typesource
- The mapping sourcepublic CreateIndexRequest mapping(java.lang.String type, java.util.Map source)
type
- The mapping typesource
- The mapping sourcepublic CreateIndexRequest mapping(java.lang.String type, java.lang.Object... source)
public CreateIndexRequest aliases(java.util.Map source)
public CreateIndexRequest aliases(XContentBuilder source)
public CreateIndexRequest aliases(java.lang.String source)
public CreateIndexRequest aliases(BytesReference source)
public CreateIndexRequest alias(Alias alias)
@Deprecated public CreateIndexRequest source(java.lang.String source)
source(String, XContentType)
public CreateIndexRequest source(java.lang.String source, XContentType xContentType)
public CreateIndexRequest source(XContentBuilder source)
@Deprecated public CreateIndexRequest source(byte[] source)
source(byte[], XContentType)
public CreateIndexRequest source(byte[] source, XContentType xContentType)
@Deprecated public CreateIndexRequest source(byte[] source, int offset, int length)
source(byte[], int, int, XContentType)
public CreateIndexRequest source(byte[] source, int offset, int length, XContentType xContentType)
@Deprecated public CreateIndexRequest source(BytesReference source)
source(BytesReference, XContentType)
public CreateIndexRequest source(BytesReference source, XContentType xContentType)
public CreateIndexRequest source(java.util.Map<java.lang.String,?> source)
public java.util.Map<java.lang.String,java.lang.String> mappings()
public java.util.Set<Alias> aliases()
public CreateIndexRequest custom(IndexMetaData.Custom custom)
public java.util.Map<java.lang.String,IndexMetaData.Custom> customs()
public boolean updateAllTypes()
public CreateIndexRequest updateAllTypes(boolean updateAllTypes)
updateAllTypes()
public ActiveShardCount waitForActiveShards()
public CreateIndexRequest waitForActiveShards(ActiveShardCount waitForActiveShards)
ActiveShardCount.DEFAULT
, which will wait for one shard copy
(the primary) to become active. Set this value to ActiveShardCount.ALL
to
wait for all shards (primary and all replicas) to be active before returning.
Otherwise, use ActiveShardCount.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. Check CreateIndexResponse.isShardsAcked()
to
determine if the requisite shard copies were all started before returning or timing out.waitForActiveShards
- number of active shard copies to wait onpublic CreateIndexRequest waitForActiveShards(int waitForActiveShards)
waitForActiveShards(ActiveShardCount)
where the numerical
shard count is passed in, instead of having to first call ActiveShardCount.from(int)
to get the ActiveShardCount.public void readFrom(StreamInput in) throws java.io.IOException
Streamable
readFrom
in interface Streamable
readFrom
in class AcknowledgedRequest<CreateIndexRequest>
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Streamable
writeTo
in interface Streamable
writeTo
in class AcknowledgedRequest<CreateIndexRequest>
java.io.IOException