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.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentObject
public class CreateIndexRequest extends TimedRequest implements Validatable, org.elasticsearch.common.xcontent.ToXContentObject
A request to create an index.
-
Nested Class Summary
-
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 CreateIndexRequestalias(org.elasticsearch.action.admin.indices.alias.Alias alias)Adds an alias that will be associated with the index when it gets createdjava.util.Set<org.elasticsearch.action.admin.indices.alias.Alias>aliases()CreateIndexRequestaliases(java.lang.String source, org.elasticsearch.common.xcontent.XContentType contentType)Sets the aliases that will be associated with the index when it gets createdCreateIndexRequestaliases(java.util.Collection<org.elasticsearch.action.admin.indices.alias.Alias> aliases)Adds aliases that will be associated with the index when it gets createdCreateIndexRequestaliases(java.util.Map<java.lang.String,?> source)Sets the aliases that will be associated with the index when it gets createdCreateIndexRequestaliases(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.xcontent.XContentType contentType)Sets the aliases that will be associated with the index when it gets createdCreateIndexRequestaliases(org.elasticsearch.common.xcontent.XContentBuilder source)Sets the aliases that will be associated with the index when it gets createdjava.lang.Stringindex()The name of the index to create.org.elasticsearch.common.xcontent.XContentBuilderinnerToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)CreateIndexRequestmapping(java.lang.String source, org.elasticsearch.common.xcontent.XContentType xContentType)Adds mapping that will be added when the index gets created.CreateIndexRequestmapping(java.util.Map<java.lang.String,?> source)Adds mapping that will be added when the index gets created.CreateIndexRequestmapping(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)Adds mapping that will be added when the index gets created.CreateIndexRequestmapping(org.elasticsearch.common.xcontent.XContentBuilder source)Adds mapping that will be added when the index gets created.org.elasticsearch.common.bytes.BytesReferencemappings()org.elasticsearch.common.xcontent.XContentTypemappingsXContentType()org.elasticsearch.common.settings.Settingssettings()The settings to create the index with.CreateIndexRequestsettings(java.lang.String source, org.elasticsearch.common.xcontent.XContentType xContentType)The settings to create the index with (either json or yaml format)CreateIndexRequestsettings(java.util.Map<java.lang.String,?> source)The settings to create the index with (either json/yaml/properties format)CreateIndexRequestsettings(org.elasticsearch.common.settings.Settings settings)The settings to create the index with.CreateIndexRequestsettings(org.elasticsearch.common.settings.Settings.Builder settings)The settings to create the index with.CreateIndexRequestsettings(org.elasticsearch.common.xcontent.XContentBuilder builder)Allows to set the settings using a json builder.CreateIndexRequestsource(java.lang.String source, org.elasticsearch.common.xcontent.XContentType xContentType)Sets the settings and mappings as a single source.CreateIndexRequestsource(java.util.Map<java.lang.String,?> source)Sets the settings and mappings as a single source.CreateIndexRequestsource(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)Sets the settings and mappings as a single source.CreateIndexRequestsource(org.elasticsearch.common.xcontent.XContentBuilder source)Sets the settings and mappings as a single source.org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)org.elasticsearch.action.support.ActiveShardCountwaitForActiveShards()CreateIndexRequestwaitForActiveShards(org.elasticsearch.action.support.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
public org.elasticsearch.common.settings.Settings 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(java.lang.String source, org.elasticsearch.common.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
public org.elasticsearch.common.bytes.BytesReference mappings() -
mappingsXContentType
public org.elasticsearch.common.xcontent.XContentType mappingsXContentType() -
mapping
public CreateIndexRequest mapping(java.lang.String source, org.elasticsearch.common.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(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.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
public java.util.Set<org.elasticsearch.action.admin.indices.alias.Alias> 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(java.lang.String source, org.elasticsearch.common.xcontent.XContentType contentType)Sets the aliases that will be associated with the index when it gets created -
aliases
public CreateIndexRequest aliases(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.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
public CreateIndexRequest aliases(java.util.Collection<org.elasticsearch.action.admin.indices.alias.Alias> aliases)Adds aliases that will be associated with the index when it gets created -
source
public CreateIndexRequest source(java.lang.String source, org.elasticsearch.common.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(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.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
public org.elasticsearch.action.support.ActiveShardCount waitForActiveShards() -
waitForActiveShards
public CreateIndexRequest waitForActiveShards(org.elasticsearch.action.support.ActiveShardCount 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
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
java.io.IOException
-
innerToXContent
public org.elasticsearch.common.xcontent.XContentBuilder innerToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Throws:
java.io.IOException
-