Class IndexRequest.Builder<TDocument>
- All Implemented Interfaces:
WithJson<IndexRequest.Builder<TDocument>>
,ObjectBuilder<IndexRequest<TDocument>>
- Enclosing class:
- IndexRequest<TDocument>
IndexRequest
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds aIndexRequest
.final IndexRequest.Builder<TDocument>
Required - Request body.final IndexRequest.Builder<TDocument>
Unique identifier for the document.final IndexRequest.Builder<TDocument>
ifPrimaryTerm
(Long value) Only perform the operation if the document has this primary term.final IndexRequest.Builder<TDocument>
Only perform the operation if the document has this sequence number.final IndexRequest.Builder<TDocument>
Required - Name of the data stream or index to target.final IndexRequest.Builder<TDocument>
Set to create to only index the document if it does not already exist (put if absent).final IndexRequest.Builder<TDocument>
ID of the pipeline to use to preprocess incoming documents.final IndexRequest.Builder<TDocument>
Iftrue
, Elasticsearch refreshes the affected shards to make this operation visible to search, ifwait_for
then wait for a refresh to make this operation visible to search, iffalse
do nothing with refreshes.final IndexRequest.Builder<TDocument>
requireAlias
(Boolean value) Iftrue
, the destination must be an index alias.final IndexRequest.Builder<TDocument>
Custom value used to route operations to a specific shard.protected IndexRequest.Builder<TDocument>
self()
final IndexRequest.Builder<TDocument>
Serializer for TDocument.final IndexRequest.Builder<TDocument>
Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.final IndexRequest.Builder<TDocument>
Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.final IndexRequest.Builder<TDocument>
Explicit version number for concurrency control.final IndexRequest.Builder<TDocument>
versionType
(VersionType value) Specific version type:external
,external_gte
.final IndexRequest.Builder<TDocument>
The number of shard copies that must be active before proceeding with the operation.final IndexRequest.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
Unique identifier for the document.API name:
id
-
ifPrimaryTerm
Only perform the operation if the document has this primary term.API name:
if_primary_term
-
ifSeqNo
Only perform the operation if the document has this sequence number.API name:
if_seq_no
-
index
Required - Name of the data stream or index to target.API name:
index
-
opType
Set to create to only index the document if it does not already exist (put if absent). If a document with the specified_id
already exists, the indexing operation will fail. Same as using the<index>/_create
endpoint. Valid values:index
,create
. If document id is specified, it defaults toindex
. Otherwise, it defaults tocreate
.API name:
op_type
-
pipeline
ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to_none
disables 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
then wait for a refresh to make this operation visible to search, iffalse
do nothing with refreshes. Valid values:true
,false
,wait_for
.API name:
refresh
-
requireAlias
Iftrue
, the destination must be an index alias.API name:
require_alias
-
routing
Custom value used to route operations to a specific shard.API name:
routing
-
timeout
Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.API name:
timeout
-
timeout
Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.API name:
timeout
-
version
Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.API name:
version
-
versionType
Specific version type:external
,external_gte
.API name:
version_type
-
waitForActiveShards
public final IndexRequest.Builder<TDocument> waitForActiveShards(@Nullable WaitForActiveShards value) The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1
).API name:
wait_for_active_shards
-
waitForActiveShards
public final IndexRequest.Builder<TDocument> waitForActiveShards(Function<WaitForActiveShards.Builder, ObjectBuilder<WaitForActiveShards>> fn) The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1
).API name:
wait_for_active_shards
-
document
Required - Request body. -
tDocumentSerializer
public final IndexRequest.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 IndexRequest.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<IndexRequest.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<IndexRequest.Builder<TDocument>>
-
build
Builds aIndexRequest
.- Specified by:
build
in interfaceObjectBuilder<TDocument>
- Throws:
NullPointerException
- if some of the required fields are null.
-