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
Constructors Constructor Description CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action)CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action, java.lang.String index)
-
Method Summary
Modifier and Type Method Description CreateIndexRequestBuilderaddAlias(Alias alias)Adds an alias that will be associated with the index when it gets createdCreateIndexRequestBuilderaddMapping(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").CreateIndexRequestBuilderaddMapping(java.lang.String type, java.lang.String source, XContentType xContentType)Adds mapping that will be added when the index gets created.CreateIndexRequestBuilderaddMapping(java.lang.String type, java.util.Map<java.lang.String,java.lang.Object> source)Adds mapping that will be added when the index gets created.CreateIndexRequestBuilderaddMapping(java.lang.String type, XContentBuilder source)Adds mapping that will be added when the index gets created.CreateIndexRequestBuildersetAliases(java.lang.String source)Sets the aliases that will be associated with the index when it gets createdCreateIndexRequestBuildersetAliases(java.util.Map<java.lang.String,?> source)Sets the aliases that will be associated with the index when it gets createdCreateIndexRequestBuildersetAliases(BytesReference source)Sets the aliases that will be associated with the index when it gets createdCreateIndexRequestBuildersetAliases(XContentBuilder source)Sets the aliases that will be associated with the index when it gets createdCreateIndexRequestBuildersetCause(java.lang.String cause)The cause for this index creation.CreateIndexRequestBuildersetIndex(java.lang.String index)Sets the name of the index to be createdCreateIndexRequestBuildersetSettings(java.lang.String source, XContentType xContentType)The settings to create the index with (either json or yaml format)CreateIndexRequestBuildersetSettings(java.util.Map<java.lang.String,?> source)The settings to create the index with (either json/yaml/properties format)CreateIndexRequestBuildersetSettings(Settings settings)The settings to create the index with.CreateIndexRequestBuildersetSettings(Settings.Builder settings)The settings to create the index with.CreateIndexRequestBuildersetSettings(XContentBuilder builder)Allows to set the settings using a json builder.CreateIndexRequestBuildersetSource(byte[] source, int offset, int length, XContentType xContentType)Sets the settings and mappings as a single source.CreateIndexRequestBuildersetSource(byte[] source, XContentType xContentType)Sets the settings and mappings as a single source.CreateIndexRequestBuildersetSource(java.lang.String source, XContentType xContentType)Sets the settings and mappings as a single source.CreateIndexRequestBuildersetSource(java.util.Map<java.lang.String,?> source)Sets the settings and mappings as a single source.CreateIndexRequestBuildersetSource(BytesReference source, XContentType xContentType)Sets the settings and mappings as a single source.CreateIndexRequestBuildersetSource(XContentBuilder source)Sets the settings and mappings as a single source.CreateIndexRequestBuildersetWaitForActiveShards(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.CreateIndexRequestBuildersetWaitForActiveShards(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 Detail
-
CreateIndexRequestBuilder
public CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action)
-
CreateIndexRequestBuilder
public CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action, java.lang.String index)
-
-
Method Detail
-
setIndex
public CreateIndexRequestBuilder setIndex(java.lang.String index)
Sets the name of the index to be created
-
setSettings
public CreateIndexRequestBuilder setSettings(Settings settings)
The settings to create the index with.
-
setSettings
public CreateIndexRequestBuilder setSettings(Settings.Builder settings)
The settings to create the index with.
-
setSettings
public CreateIndexRequestBuilder setSettings(XContentBuilder builder)
Allows to set the settings using a json builder.
-
setSettings
public CreateIndexRequestBuilder setSettings(java.lang.String source, XContentType xContentType)
The settings to create the index with (either json or yaml format)
-
setSettings
public CreateIndexRequestBuilder setSettings(java.util.Map<java.lang.String,?> source)
The settings to create the index with (either json/yaml/properties format)
-
addMapping
public CreateIndexRequestBuilder addMapping(java.lang.String type, java.lang.String source, 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
public CreateIndexRequestBuilder setCause(java.lang.String cause)
The cause for this index creation.
-
addMapping
public CreateIndexRequestBuilder addMapping(java.lang.String type, XContentBuilder source)
Adds mapping that will be added when the index gets created.- Parameters:
type- The mapping typesource- The mapping source
-
addMapping
public CreateIndexRequestBuilder addMapping(java.lang.String type, java.util.Map<java.lang.String,java.lang.Object> source)
Adds mapping that will be added when the index gets created.- Parameters:
type- The mapping typesource- The mapping source
-
addMapping
public CreateIndexRequestBuilder addMapping(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").
-
setAliases
public CreateIndexRequestBuilder setAliases(java.util.Map<java.lang.String,?> source)
Sets the aliases that will be associated with the index when it gets created
-
setAliases
public CreateIndexRequestBuilder setAliases(java.lang.String source)
Sets the aliases that will be associated with the index when it gets created
-
setAliases
public CreateIndexRequestBuilder setAliases(XContentBuilder source)
Sets the aliases that will be associated with the index when it gets created
-
setAliases
public CreateIndexRequestBuilder setAliases(BytesReference source)
Sets the aliases that will be associated with the index when it gets created
-
addAlias
public CreateIndexRequestBuilder addAlias(Alias alias)
Adds an alias that will be associated with the index when it gets created
-
setSource
public CreateIndexRequestBuilder setSource(java.lang.String source, XContentType xContentType)
Sets the settings and mappings as a single source.
-
setSource
public CreateIndexRequestBuilder setSource(BytesReference source, XContentType xContentType)
Sets the settings and mappings as a single source.
-
setSource
public CreateIndexRequestBuilder setSource(byte[] source, XContentType xContentType)
Sets the settings and mappings as a single source.
-
setSource
public CreateIndexRequestBuilder setSource(byte[] source, int offset, int length, XContentType xContentType)
Sets the settings and mappings as a single source.
-
setSource
public CreateIndexRequestBuilder setSource(java.util.Map<java.lang.String,?> source)
Sets the settings and mappings as a single source.
-
setSource
public CreateIndexRequestBuilder setSource(XContentBuilder source)
Sets the settings and mappings as a single source.
-
setWaitForActiveShards
public CreateIndexRequestBuilder setWaitForActiveShards(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
-
setWaitForActiveShards
public CreateIndexRequestBuilder 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.
-
-