Class CreateRequest.Builder<TDocument>
- All Implemented Interfaces:
WithJson<CreateRequest.Builder<TDocument>>
,ObjectBuilder<CreateRequest<TDocument>>
- Enclosing class:
- CreateRequest<TDocument>
CreateRequest
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds aCreateRequest
.final CreateRequest.Builder<TDocument>
Required - Request body.final CreateRequest.Builder<TDocument>
Required - A unique identifier for the document.final CreateRequest.Builder<TDocument>
Required - The name of the data stream or index to target.final CreateRequest.Builder<TDocument>
The ID of the pipeline to use to preprocess incoming documents.final CreateRequest.Builder<TDocument>
Iftrue
, Elasticsearch refreshes the affected shards to make this operation visible to search.final CreateRequest.Builder<TDocument>
A custom value that is used to route operations to a specific shard.protected CreateRequest.Builder<TDocument>
self()
final CreateRequest.Builder<TDocument>
Serializer for TDocument.final CreateRequest.Builder<TDocument>
The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.final CreateRequest.Builder<TDocument>
The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.final CreateRequest.Builder<TDocument>
The explicit version number for concurrency control.final CreateRequest.Builder<TDocument>
versionType
(VersionType value) The version type.final CreateRequest.Builder<TDocument>
The number of shard copies that must be active before proceeding with the operation.final CreateRequest.Builder<TDocument>
The number of shard copies that must be active before proceeding with the operation.withJson
(jakarta.json.stream.JsonParser parser, JsonpMapper mapper) Sets additional properties values on this object by reading from a JSON input.Methods inherited from class co.elastic.clients.util.ObjectBuilderBase
_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
id
Required - A unique identifier for the document. To automatically generate a document ID, use thePOST /<target>/_doc/
request format.API name:
id
-
index
Required - The name of the data stream or index to target. If the target doesn't exist and matches the name or wildcard (*
) pattern of an index template with adata_stream
definition, this request creates the data stream. If the target doesn't exist and doesn’t match a data stream template, this request creates the index.API name:
index
-
pipeline
The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, setting the value to_none
turns off the default ingest pipeline for this request. If a final pipeline is configured, it will always run regardless of the value of this parameter.API name:
pipeline
-
refresh
Iftrue
, Elasticsearch refreshes the affected shards to make this operation visible to search. Ifwait_for
, it waits for a refresh to make this operation visible to search. Iffalse
, it does nothing with refreshes.API name:
refresh
-
routing
A custom value that is used to route operations to a specific shard.API name:
routing
-
timeout
The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. Elasticsearch waits for at least the specified timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur.This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. The actual wait time could be longer, particularly when multiple waits occur.
API name:
timeout
-
timeout
public final CreateRequest.Builder<TDocument> timeout(Function<Time.Builder, ObjectBuilder<Time>> fn) The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. Elasticsearch waits for at least the specified timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur.This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. The actual wait time could be longer, particularly when multiple waits occur.
API name:
timeout
-
version
The explicit version number for concurrency control. It must be a non-negative long number.API name:
version
-
versionType
The version type.API name:
version_type
-
waitForActiveShards
public final CreateRequest.Builder<TDocument> waitForActiveShards(@Nullable WaitForActiveShards value) The number of shard copies that must be active before proceeding with the operation. You can set it toall
or any positive integer up to the total number of shards in the index (number_of_replicas+1
). The default value of1
means it waits for each primary shard to be active.API name:
wait_for_active_shards
-
waitForActiveShards
public final CreateRequest.Builder<TDocument> waitForActiveShards(Function<WaitForActiveShards.Builder, ObjectBuilder<WaitForActiveShards>> fn) The number of shard copies that must be active before proceeding with the operation. You can set it toall
or any positive integer up to the total number of shards in the index (number_of_replicas+1
). The default value of1
means it waits for each primary shard to be active.API name:
wait_for_active_shards
-
document
Required - Request body. -
tDocumentSerializer
public final CreateRequest.Builder<TDocument> tDocumentSerializer(@Nullable JsonpSerializer<TDocument> value) Serializer for TDocument. If not set, an attempt will be made to find a serializer from the JSON context. -
withJson
public CreateRequest.Builder<TDocument> withJson(jakarta.json.stream.JsonParser parser, JsonpMapper mapper) Description copied from interface:WithJson
Sets additional properties values on this object by reading from a JSON input.This is a "partial deserialization": properties that were already set keep their value if they're not present in the JSON input, and properties can also be set after having called this method, including overriding those read from the JSON input.
This low level variant of
withJson
gives full control on the json parser and object mapper. Most of the time usingWithJson.withJson(Reader)
andWithJson.withJson(InputStream)
will be more convenient.- Specified by:
withJson
in interfaceWithJson<TDocument>
- Overrides:
withJson
in classWithJsonObjectBuilderBase<CreateRequest.Builder<TDocument>>
- Parameters:
parser
- the JSONP parsermapper
- the JSONP mapper used to deserialize values and nested objects- Returns:
- this object
-
self
- Specified by:
self
in classRequestBase.AbstractBuilder<CreateRequest.Builder<TDocument>>
-
build
Builds aCreateRequest
.- Specified by:
build
in interfaceObjectBuilder<TDocument>
- Throws:
NullPointerException
- if some of the required fields are null.
-