Package org.elasticsearch.client.indices
Class CreateIndexRequest
java.lang.Object
org.elasticsearch.client.TimedRequest
org.elasticsearch.client.indices.CreateIndexRequest
- All Implemented Interfaces:
Validatable
,org.elasticsearch.xcontent.ToXContent
,org.elasticsearch.xcontent.ToXContentObject
public class CreateIndexRequest
extends TimedRequest
implements Validatable, org.elasticsearch.xcontent.ToXContentObject
A request to create an index.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params
-
Field Summary
Fields inherited from class org.elasticsearch.client.TimedRequest
DEFAULT_ACK_TIMEOUT, DEFAULT_MASTER_NODE_TIMEOUT
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS
Fields inherited from interface org.elasticsearch.client.Validatable
EMPTY
-
Constructor Summary
ConstructorDescriptionCreateIndexRequest
(String index) Constructs a new request to create an index with the specified name. -
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 createdaliases
(Collection<Alias> aliases) Adds 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, org.elasticsearch.xcontent.XContentType contentType) Sets the aliases that will be associated with the index when it gets createdaliases
(org.elasticsearch.xcontent.XContentBuilder source) Sets the aliases that will be associated with the index when it gets createdindex()
The name of the index to create.org.elasticsearch.xcontent.XContentBuilder
innerToXContent
(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) Adds mapping that will be added when the index gets created.Adds mapping that will be added when the index gets created.mapping
(BytesReference source, org.elasticsearch.xcontent.XContentType xContentType) Adds mapping that will be added when the index gets created.mapping
(org.elasticsearch.xcontent.XContentBuilder source) Adds mapping that will be added when the index gets created.mappings()
org.elasticsearch.xcontent.XContentType
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.xcontent.XContentBuilder builder) Allows to set the settings using a json builder.Sets the settings and mappings as a single source.Sets the settings and mappings as a single source.source
(BytesReference source, org.elasticsearch.xcontent.XContentType xContentType) Sets the settings and mappings as a single source.source
(org.elasticsearch.xcontent.XContentBuilder source) Sets the settings and mappings as a single source.org.elasticsearch.xcontent.XContentBuilder
toXContent
(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
Methods inherited from interface org.elasticsearch.client.Validatable
validate
-
Constructor Details
-
CreateIndexRequest
Constructs a new request to create an index with the specified name.
-
-
Method Details
-
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
public CreateIndexRequest settings(String source, org.elasticsearch.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) -
mappings
-
mappingsXContentType
public org.elasticsearch.xcontent.XContentType mappingsXContentType() -
mapping
public CreateIndexRequest mapping(String source, org.elasticsearch.xcontent.XContentType xContentType) 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
public CreateIndexRequest mapping(BytesReference source, org.elasticsearch.xcontent.XContentType xContentType) 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
public CreateIndexRequest aliases(String source, org.elasticsearch.xcontent.XContentType contentType) Sets the aliases that will be associated with the index when it gets created -
aliases
public CreateIndexRequest aliases(BytesReference source, org.elasticsearch.xcontent.XContentType contentType) 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
public CreateIndexRequest source(String source, org.elasticsearch.xcontent.XContentType xContentType) 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
public CreateIndexRequest source(BytesReference source, org.elasticsearch.xcontent.XContentType xContentType) 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 org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceorg.elasticsearch.xcontent.ToXContent
- Throws:
IOException
-
innerToXContent
public org.elasticsearch.xcontent.XContentBuilder innerToXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Throws:
IOException
-