Package org.elasticsearch.client.indices
Class CreateIndexRequest
java.lang.Object
org.elasticsearch.client.TimedRequest
org.elasticsearch.client.indices.CreateIndexRequest
- All Implemented Interfaces:
Validatable
,ToXContent
,ToXContentObject
public class CreateIndexRequest extends TimedRequest implements Validatable, ToXContentObject
A request to create an index.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Field Summary
Fields inherited from class org.elasticsearch.client.TimedRequest
DEFAULT_ACK_TIMEOUT, DEFAULT_MASTER_NODE_TIMEOUT
-
Constructor Summary
Constructors Constructor Description CreateIndexRequest(java.lang.String index)
Constructs a new request to create an index with the specified name. -
Method Summary
Modifier and Type Method Description CreateIndexRequest
alias(Alias alias)
Adds an alias that will be associated with the index when it gets createdjava.util.Set<Alias>
aliases()
CreateIndexRequest
aliases(java.lang.String source, XContentType contentType)
Sets the aliases that will be associated with the index when it gets createdCreateIndexRequest
aliases(java.util.Collection<Alias> aliases)
Adds aliases that will be associated with the index when it gets createdCreateIndexRequest
aliases(java.util.Map<java.lang.String,?> source)
Sets the aliases that will be associated with the index when it gets createdCreateIndexRequest
aliases(BytesReference source, XContentType contentType)
Sets the aliases that will be associated with the index when it gets createdCreateIndexRequest
aliases(XContentBuilder source)
Sets the aliases that will be associated with the index when it gets createdjava.lang.String
index()
The name of the index to create.XContentBuilder
innerToXContent(XContentBuilder builder, ToXContent.Params params)
CreateIndexRequest
mapping(java.lang.String source, XContentType xContentType)
Adds mapping that will be added when the index gets created.CreateIndexRequest
mapping(java.util.Map<java.lang.String,?> source)
Adds mapping that will be added when the index gets created.CreateIndexRequest
mapping(BytesReference source, XContentType xContentType)
Adds mapping that will be added when the index gets created.CreateIndexRequest
mapping(XContentBuilder source)
Adds mapping that will be added when the index gets created.BytesReference
mappings()
XContentType
mappingsXContentType()
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<java.lang.String,?> 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(java.lang.String 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(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)
ActiveShardCount
waitForActiveShards()
CreateIndexRequest
waitForActiveShards(ActiveShardCount waitForActiveShards)
Sets the number of shard copies that should be active for index creation to return.Methods inherited from class org.elasticsearch.client.TimedRequest
masterNodeTimeout, setMasterTimeout, setTimeout, timeout
-
Constructor Details
-
CreateIndexRequest
public CreateIndexRequest(java.lang.String index)Constructs a new request to create an index with the specified name.
-
-
Method Details
-
index
public java.lang.String index()The name of the index to create. -
settings
The settings to create the index with. -
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) -
mappings
-
mappingsXContentType
-
mapping
Adds mapping that will be added when the index gets created. Note that the definition should *not* be nested under a type name.- Parameters:
source
- The mapping sourcexContentType
- The content type of the source
-
mapping
Adds mapping that will be added when the index gets created. Note that the definition should *not* be nested under a type name.- Parameters:
source
- The mapping source
-
mapping
Adds mapping that will be added when the index gets created. Note that the definition should *not* be nested under a type name.- Parameters:
source
- The mapping source
-
mapping
Adds mapping that will be added when the index gets created. Note that the definition should *not* be nested under a type name.- Parameters:
source
- The mapping sourcexContentType
- the content type of the mapping source
-
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 associated with the index when it gets created -
aliases
Adds aliases that will be associated with the index when it gets created -
source
Sets the settings and mappings as a single source. Note that the mapping definition should *not* be nested under a type name. -
source
Sets the settings and mappings as a single source. Note that the mapping definition should *not* be nested under a type name. -
source
Sets the settings and mappings as a single source. Note that the mapping definition should *not* be nested under a type name. -
source
Sets the settings and mappings as a single source. Note that the mapping definition should *not* be nested under a type name. -
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
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
innerToXContent
public XContentBuilder innerToXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Throws:
java.io.IOException
-