IndicesRequest
, AckedRequest
, Streamable
, Writeable
, ToXContent
, ToXContentObject
, TaskAwareRequest
public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest> implements IndicesRequest, ToXContentObject
Requests.createIndexRequest(String)
.
The index created can optionally be created with settings(org.elasticsearch.common.settings.Settings)
.
IndicesRequest.Replaceable
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
TransportRequest.Empty
Writeable.Reader<V>, Writeable.Writer<V>
Modifier and Type | Field | Description |
---|---|---|
static ParseField |
ALIASES |
|
static ParseField |
MAPPINGS |
|
static ParseField |
SETTINGS |
DEFAULT_ACK_TIMEOUT, timeout
DEFAULT_MASTER_NODE_TIMEOUT, masterNodeTimeout
EMPTY_PARAMS
Constructor | 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 | 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(java.lang.String 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(BytesReference 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.
|
XContentBuilder |
innerToXContent(XContentBuilder builder,
ToXContent.Params params) |
|
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,
XContentType xContentType) |
Adds mapping that will be added when the index gets created.
|
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,
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.lang.String source,
XContentType xContentType) |
The settings to create the index with (either json or yaml format)
|
CreateIndexRequest |
settings(java.util.Map source) |
The settings to create the index with (either json/yaml/properties format)
|
CreateIndexRequest |
settings(Settings settings) |
The settings to create the index with.
|
CreateIndexRequest |
settings(Settings.Builder settings) |
The settings to create the index with.
|
CreateIndexRequest |
settings(XContentBuilder builder) |
Allows to set the settings using a json builder.
|
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(java.lang.String source,
XContentType xContentType) |
Sets the settings and mappings as a single source.
|
CreateIndexRequest |
source(java.util.Map<java.lang.String,?> source,
DeprecationHandler deprecationHandler) |
Sets the settings and mappings as a single source.
|
CreateIndexRequest |
source(BytesReference 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.
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
|
boolean |
updateAllTypes() |
True if all fields that span multiple types should be updated, false otherwise
|
CreateIndexRequest |
updateAllTypes(boolean updateAllTypes) |
Deprecated.
useless with 6.x indices which may only have one type
|
ActionRequestValidationException |
validate() |
|
ActiveShardCount |
waitForActiveShards() |
|
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. |
CreateIndexRequest |
waitForActiveShards(ActiveShardCount waitForActiveShards) |
Sets the number of shard copies that should be active for index creation to return.
|
void |
writeTo(StreamOutput out) |
Write this object's fields to a StreamOutput.
|
masterNodeTimeout
ackTimeout, timeout, timeout, timeout
getShouldStoreResult
masterNodeTimeout, masterNodeTimeout, masterNodeTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createTask, getDescription, setParentTask
isFragment
remoteAddress, remoteAddress
getParentTask, setParentTask
public static final ParseField MAPPINGS
public static final ParseField SETTINGS
public static final ParseField ALIASES
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(Settings.Builder settings)
public CreateIndexRequest settings(Settings settings)
public CreateIndexRequest settings(java.lang.String source, XContentType xContentType)
public CreateIndexRequest settings(XContentBuilder builder)
public CreateIndexRequest settings(java.util.Map source)
public 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)
public CreateIndexRequest source(java.lang.String source, XContentType xContentType)
public CreateIndexRequest source(XContentBuilder source)
public CreateIndexRequest source(byte[] source, XContentType xContentType)
public CreateIndexRequest source(byte[] source, int offset, int length, XContentType xContentType)
public CreateIndexRequest source(BytesReference source, XContentType xContentType)
public CreateIndexRequest source(java.util.Map<java.lang.String,?> source, DeprecationHandler deprecationHandler)
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()
@Deprecated 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 ShardsAcknowledgedResponse.isShardsAcknowledged()
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 interface Writeable
writeTo
in class AcknowledgedRequest<CreateIndexRequest>
java.io.IOException
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent
in interface ToXContent
java.io.IOException
public XContentBuilder innerToXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOException