Class CreateIndexRequestBuilder
java.lang.Object
org.elasticsearch.action.ActionRequestBuilder<Request,Response>
org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder<Request,Response,RequestBuilder>
org.elasticsearch.action.support.master.AcknowledgedRequestBuilder<CreateIndexRequest,CreateIndexResponse,CreateIndexRequestBuilder>
org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder
public class CreateIndexRequestBuilder
extends AcknowledgedRequestBuilder<CreateIndexRequest,CreateIndexResponse,CreateIndexRequestBuilder>
Builder for a create index request
-
Field Summary
Fields inherited from class org.elasticsearch.action.ActionRequestBuilder
action, client, request
-
Constructor Summary
ConstructorDescriptionCreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action)
CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action, String index)
-
Method Summary
Modifier and TypeMethodDescriptionAdds an alias that will be associated with the index when it gets createdaddMapping(String type, Object... source)
A specialized simplified mapping source method, takes the form of simple properties definition: ("field1", "type=string,store=true").addMapping(String type, String source, org.elasticsearch.common.xcontent.XContentType xContentType)
Adds mapping that will be added when the index gets created.addMapping(String type, Map<String,Object> source)
Adds mapping that will be added when the index gets created.addMapping(String type, org.elasticsearch.common.xcontent.XContentBuilder source)
Adds mapping that will be added when the index gets created.setAliases(String source)
Sets the aliases that will be associated with the index when it gets createdsetAliases(Map<String,?> source)
Sets the aliases that will be associated with the index when it gets createdsetAliases(BytesReference source)
Sets the aliases that will be associated with the index when it gets createdsetAliases(org.elasticsearch.common.xcontent.XContentBuilder source)
Sets the aliases that will be associated with the index when it gets createdThe cause for this index creation.Sets the name of the index to be createdsetSettings(String source, org.elasticsearch.common.xcontent.XContentType xContentType)
The settings to create the index with (either json or yaml format)setSettings(Map<String,?> source)
The settings to create the index with (either json/yaml/properties format)setSettings(Settings settings)
The settings to create the index with.setSettings(Settings.Builder settings)
The settings to create the index with.setSettings(org.elasticsearch.common.xcontent.XContentBuilder builder)
Allows to set the settings using a json builder.setSource(byte[] source, int offset, int length, org.elasticsearch.common.xcontent.XContentType xContentType)
Sets the settings and mappings as a single source.setSource(byte[] source, org.elasticsearch.common.xcontent.XContentType xContentType)
Sets the settings and mappings as a single source.Sets the settings and mappings as a single source.Sets the settings and mappings as a single source.setSource(BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)
Sets the settings and mappings as a single source.setSource(org.elasticsearch.common.xcontent.XContentBuilder source)
Sets the settings and mappings as a single source.setWaitForActiveShards(int waitForActiveShards)
A shortcut forsetWaitForActiveShards(ActiveShardCount)
where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)
to get the ActiveShardCount.setWaitForActiveShards(ActiveShardCount waitForActiveShards)
Sets the number of shard copies that should be active for index creation to return.Methods inherited from class org.elasticsearch.action.support.master.AcknowledgedRequestBuilder
setTimeout, setTimeout
Methods inherited from class org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder
setMasterNodeTimeout, setMasterNodeTimeout
-
Constructor Details
-
CreateIndexRequestBuilder
-
CreateIndexRequestBuilder
public CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action, String index)
-
-
Method Details
-
setIndex
Sets the name of the index to be created -
setSettings
The settings to create the index with. -
setSettings
The settings to create the index with. -
setSettings
public CreateIndexRequestBuilder setSettings(org.elasticsearch.common.xcontent.XContentBuilder builder)Allows to set the settings using a json builder. -
setSettings
public CreateIndexRequestBuilder setSettings(String source, org.elasticsearch.common.xcontent.XContentType xContentType)The settings to create the index with (either json or yaml format) -
setSettings
The settings to create the index with (either json/yaml/properties format) -
addMapping
public CreateIndexRequestBuilder addMapping(String type, String source, org.elasticsearch.common.xcontent.XContentType xContentType)Adds mapping that will be added when the index gets created.- Parameters:
type
- The mapping typesource
- The mapping sourcexContentType
- The content type of the source
-
setCause
The cause for this index creation. -
addMapping
public CreateIndexRequestBuilder addMapping(String type, org.elasticsearch.common.xcontent.XContentBuilder source)Adds mapping that will be added when the index gets created.- Parameters:
type
- The mapping typesource
- The mapping source
-
addMapping
Adds mapping that will be added when the index gets created.- Parameters:
type
- The mapping typesource
- The mapping source
-
addMapping
A specialized simplified mapping source method, takes the form of simple properties definition: ("field1", "type=string,store=true"). -
setAliases
Sets the aliases that will be associated with the index when it gets created -
setAliases
Sets the aliases that will be associated with the index when it gets created -
setAliases
public CreateIndexRequestBuilder setAliases(org.elasticsearch.common.xcontent.XContentBuilder source)Sets the aliases that will be associated with the index when it gets created -
setAliases
Sets the aliases that will be associated with the index when it gets created -
addAlias
Adds an alias that will be associated with the index when it gets created -
setSource
public CreateIndexRequestBuilder setSource(String source, org.elasticsearch.common.xcontent.XContentType xContentType)Sets the settings and mappings as a single source. -
setSource
public CreateIndexRequestBuilder setSource(BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)Sets the settings and mappings as a single source. -
setSource
public CreateIndexRequestBuilder setSource(byte[] source, org.elasticsearch.common.xcontent.XContentType xContentType)Sets the settings and mappings as a single source. -
setSource
public CreateIndexRequestBuilder setSource(byte[] source, int offset, int length, org.elasticsearch.common.xcontent.XContentType xContentType)Sets the settings and mappings as a single source. -
setSource
Sets the settings and mappings as a single source. -
setSource
public CreateIndexRequestBuilder setSource(org.elasticsearch.common.xcontent.XContentBuilder source)Sets the settings and mappings as a single source. -
setWaitForActiveShards
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
-
setWaitForActiveShards
A shortcut forsetWaitForActiveShards(ActiveShardCount)
where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)
to get the ActiveShardCount.
-