public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<CreateIndexRequest,CreateIndexResponse,CreateIndexRequestBuilder>
action, client, request
Constructor and Description |
---|
CreateIndexRequestBuilder(ElasticsearchClient client,
CreateIndexAction action) |
CreateIndexRequestBuilder(ElasticsearchClient client,
CreateIndexAction action,
java.lang.String index) |
Modifier and Type | Method and Description |
---|---|
CreateIndexRequestBuilder |
addAlias(Alias alias)
Adds an alias that will be associated with the index when it gets created
|
CreateIndexRequestBuilder |
addCustom(IndexMetaData.Custom custom)
Adds custom metadata to the index to be created.
|
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.
|
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").
|
CreateIndexRequestBuilder |
addMapping(java.lang.String type,
java.lang.String source)
Deprecated.
use
addMapping(String, String, XContentType) to avoid content type auto-detection |
CreateIndexRequestBuilder |
addMapping(java.lang.String type,
java.lang.String source,
XContentType xContentType)
Adds mapping that will be added when the index gets created.
|
CreateIndexRequestBuilder |
addMapping(java.lang.String type,
XContentBuilder source)
Adds mapping that will be added when the index gets created.
|
CreateIndexRequestBuilder |
setAliases(BytesReference source)
Sets the aliases that will be associated with the index when it gets created
|
CreateIndexRequestBuilder |
setAliases(java.util.Map source)
Sets the aliases that will be associated with the index when it gets created
|
CreateIndexRequestBuilder |
setAliases(java.lang.String source)
Sets the aliases that will be associated with the index when it gets created
|
CreateIndexRequestBuilder |
setAliases(XContentBuilder source)
Sets the aliases that will be associated with the index when it gets created
|
CreateIndexRequestBuilder |
setCause(java.lang.String cause)
The cause for this index creation.
|
CreateIndexRequestBuilder |
setIndex(java.lang.String index)
Sets the name of the index to be created
|
CreateIndexRequestBuilder |
setSettings(java.util.Map<java.lang.String,?> source)
The settings to create the index with (either json/yaml/properties format)
|
CreateIndexRequestBuilder |
setSettings(java.lang.Object... settings)
A simplified version of settings that takes key value pairs settings.
|
CreateIndexRequestBuilder |
setSettings(Settings.Builder settings)
The settings to create the index with.
|
CreateIndexRequestBuilder |
setSettings(Settings settings)
The settings to create the index with.
|
CreateIndexRequestBuilder |
setSettings(java.lang.String source)
Deprecated.
use
setSettings(String, XContentType) to avoid content type detection |
CreateIndexRequestBuilder |
setSettings(java.lang.String source,
XContentType xContentType)
The settings to create the index with (either json or yaml format)
|
CreateIndexRequestBuilder |
setSettings(XContentBuilder builder)
Allows to set the settings using a json builder.
|
CreateIndexRequestBuilder |
setSource(byte[] source)
Deprecated.
|
CreateIndexRequestBuilder |
setSource(byte[] source,
int offset,
int length)
Deprecated.
|
CreateIndexRequestBuilder |
setSource(byte[] source,
int offset,
int length,
XContentType xContentType)
Sets the settings and mappings as a single source.
|
CreateIndexRequestBuilder |
setSource(byte[] source,
XContentType xContentType)
Sets the settings and mappings as a single source.
|
CreateIndexRequestBuilder |
setSource(BytesReference source)
Deprecated.
|
CreateIndexRequestBuilder |
setSource(BytesReference source,
XContentType xContentType)
Sets the settings and mappings as a single source.
|
CreateIndexRequestBuilder |
setSource(java.util.Map<java.lang.String,?> source)
Sets the settings and mappings as a single source.
|
CreateIndexRequestBuilder |
setSource(java.lang.String source)
Deprecated.
|
CreateIndexRequestBuilder |
setSource(java.lang.String source,
XContentType xContentType)
Sets the settings and mappings as a single source.
|
CreateIndexRequestBuilder |
setSource(XContentBuilder source)
Sets the settings and mappings as a single source.
|
CreateIndexRequestBuilder |
setUpdateAllTypes(boolean updateAllTypes)
True if all fields that span multiple types should be updated, false otherwise
|
CreateIndexRequestBuilder |
setWaitForActiveShards(ActiveShardCount waitForActiveShards)
Sets the number of shard copies that should be active for index creation to return.
|
CreateIndexRequestBuilder |
setWaitForActiveShards(int waitForActiveShards)
A shortcut for
setWaitForActiveShards(ActiveShardCount) where the numerical
shard count is passed in, instead of having to first call ActiveShardCount.from(int)
to get the ActiveShardCount. |
setTimeout, setTimeout
setMasterNodeTimeout, setMasterNodeTimeout
beforeExecute, execute, execute, get, get, get, request
public CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action)
public CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action, java.lang.String index)
public CreateIndexRequestBuilder setIndex(java.lang.String index)
public CreateIndexRequestBuilder setSettings(Settings settings)
public CreateIndexRequestBuilder setSettings(Settings.Builder settings)
public CreateIndexRequestBuilder setSettings(XContentBuilder builder)
@Deprecated public CreateIndexRequestBuilder setSettings(java.lang.String source)
setSettings(String, XContentType)
to avoid content type detectionpublic CreateIndexRequestBuilder setSettings(java.lang.String source, XContentType xContentType)
public CreateIndexRequestBuilder setSettings(java.lang.Object... settings)
public CreateIndexRequestBuilder setSettings(java.util.Map<java.lang.String,?> source)
@Deprecated public CreateIndexRequestBuilder addMapping(java.lang.String type, java.lang.String source)
addMapping(String, String, XContentType)
to avoid content type auto-detectiontype
- The mapping typesource
- The mapping sourcepublic CreateIndexRequestBuilder addMapping(java.lang.String type, java.lang.String source, XContentType xContentType)
type
- The mapping typesource
- The mapping sourcexContentType
- The content type of the sourcepublic CreateIndexRequestBuilder setCause(java.lang.String cause)
public CreateIndexRequestBuilder addMapping(java.lang.String type, XContentBuilder source)
type
- The mapping typesource
- The mapping sourcepublic CreateIndexRequestBuilder addMapping(java.lang.String type, java.util.Map<java.lang.String,java.lang.Object> source)
type
- The mapping typesource
- The mapping sourcepublic CreateIndexRequestBuilder addMapping(java.lang.String type, java.lang.Object... source)
public CreateIndexRequestBuilder setAliases(java.util.Map source)
public CreateIndexRequestBuilder setAliases(java.lang.String source)
public CreateIndexRequestBuilder setAliases(XContentBuilder source)
public CreateIndexRequestBuilder setAliases(BytesReference source)
public CreateIndexRequestBuilder addAlias(Alias alias)
@Deprecated public CreateIndexRequestBuilder setSource(java.lang.String source)
setSource(String, XContentType)
public CreateIndexRequestBuilder setSource(java.lang.String source, XContentType xContentType)
@Deprecated public CreateIndexRequestBuilder setSource(BytesReference source)
setSource(BytesReference, XContentType)
public CreateIndexRequestBuilder setSource(BytesReference source, XContentType xContentType)
@Deprecated public CreateIndexRequestBuilder setSource(byte[] source)
setSource(byte[], XContentType)
public CreateIndexRequestBuilder setSource(byte[] source, XContentType xContentType)
@Deprecated public CreateIndexRequestBuilder setSource(byte[] source, int offset, int length)
setSource(byte[], int, int, XContentType)
public CreateIndexRequestBuilder setSource(byte[] source, int offset, int length, XContentType xContentType)
public CreateIndexRequestBuilder setSource(java.util.Map<java.lang.String,?> source)
public CreateIndexRequestBuilder addCustom(IndexMetaData.Custom custom)
public CreateIndexRequestBuilder setSource(XContentBuilder source)
public CreateIndexRequestBuilder setUpdateAllTypes(boolean updateAllTypes)
public CreateIndexRequestBuilder setWaitForActiveShards(ActiveShardCount waitForActiveShards)
ActiveShardCount.DEFAULT
, which will wait for one shard copy
(the primary) to become active. Set this value to ActiveShardCount.ALL
to
wait for all shards (primary and all replicas) to be active before returning.
Otherwise, use ActiveShardCount.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. Check CreateIndexResponse.isShardsAcked()
to
determine if the requisite shard copies were all started before returning or timing out.waitForActiveShards
- number of active shard copies to wait onpublic CreateIndexRequestBuilder setWaitForActiveShards(int waitForActiveShards)
setWaitForActiveShards(ActiveShardCount)
where the numerical
shard count is passed in, instead of having to first call ActiveShardCount.from(int)
to get the ActiveShardCount.