Class CreateIndexRequest
- All Implemented Interfaces:
JsonpSerializable
- Settings for the index.
- Mappings for fields in the index.
- Index aliases
Wait for active shards
By default, index creation will only return a response to the client when the
primary copies of each shard have been started, or the request times out. The
index creation response will indicate what happened. For example,
acknowledged
indicates whether the index was successfully
created in the cluster, while shards_acknowledged
indicates
whether the requisite number of shard copies were started for each shard in
the index before timing out. Note that it is still possible for either
acknowledged
or shards_acknowledged
to be
false
, but for the index creation to be successful. These values
simply indicate whether the operation completed before the timeout. If
acknowledged
is false, the request timed out before the cluster
state was updated with the newly created index, but it probably will be
created sometime soon. If shards_acknowledged
is false, then the
request timed out before the requisite number of shards were started (by
default just the primaries), even if the cluster state was successfully
updated to reflect the newly created index (that is to say,
acknowledged
is true
).
You can change the default of only waiting for the primary shards to start
through the index setting index.write.wait_for_active_shards
.
Note that changing this setting will also affect the
wait_for_active_shards
value on all subsequent write operations.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class co.elastic.clients.elasticsearch._types.RequestBase
RequestBase.AbstractBuilder<BuilderT extends RequestBase.AbstractBuilder<BuilderT>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonpDeserializer<CreateIndexRequest>
Json deserializer forCreateIndexRequest
static final Endpoint<CreateIndexRequest,
CreateIndexResponse, ErrorResponse> Endpoint "indices.create
". -
Method Summary
Modifier and TypeMethodDescriptionaliases()
Aliases for the index.final String
index()
Required - Name of the index you wish to create.final TypeMapping
mappings()
Mapping for fields in the index.final Time
Period to wait for a connection to the master node.static CreateIndexRequest
void
serialize
(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize this object to JSON.protected void
serializeInternal
(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) final IndexSettings
settings()
Configuration options for the index.protected static void
final Time
timeout()
Period to wait for a response.final WaitForActiveShards
The number of shard copies that must be active before proceeding with the operation.Methods inherited from class co.elastic.clients.elasticsearch._types.RequestBase
toString
-
Field Details
-
_DESERIALIZER
Json deserializer forCreateIndexRequest
-
_ENDPOINT
Endpoint "indices.create
".
-
-
Method Details
-
of
public static CreateIndexRequest of(Function<CreateIndexRequest.Builder, ObjectBuilder<CreateIndexRequest>> fn) -
aliases
Aliases for the index.API name:
aliases
-
index
Required - Name of the index you wish to create. Index names must meet the following criteria:- Lowercase only
- Cannot include
\
,/
,*
,?
,"
,<
,>
,|
,,
, or#
- Indices prior to 7.0 could contain a colon (
:
), but that has been deprecated and will not be supported in later versions - Cannot start with
-
,_
, or+
- Cannot be
.
or..
- Cannot be longer than 255 bytes (note thtat it is bytes, so multi-byte characters will reach the limit faster)
- Names starting with
.
are deprecated, except for hidden indices and internal indices managed by plugins
API name:
index
-
mappings
Mapping for fields in the index. If specified, this mapping can include:- Field names
- Field data types
- Mapping parameters
API name:
mappings
-
masterTimeout
Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.API name:
master_timeout
-
settings
Configuration options for the index.API name:
settings
-
timeout
Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.API name:
timeout
-
waitForActiveShards
The number of shard copies that must be active before proceeding with the operation. Set toall
or any positive integer up to the total number of shards in the index (number_of_replicas+1
).API name:
wait_for_active_shards
-
serialize
Serialize this object to JSON.- Specified by:
serialize
in interfaceJsonpSerializable
-
serializeInternal
-
setupCreateIndexRequestDeserializer
protected static void setupCreateIndexRequestDeserializer(ObjectDeserializer<CreateIndexRequest.Builder> op)
-