Class IndexRequest.Builder<TDocument>
- All Implemented Interfaces:
WithJson<IndexRequest.Builder<TDocument>>
,ObjectBuilder<IndexRequest<TDocument>>
- Enclosing class:
- IndexRequest<TDocument>
public static class IndexRequest.Builder<TDocument> extends WithJsonObjectBuilderBase<IndexRequest.Builder<TDocument>> implements ObjectBuilder<IndexRequest<TDocument>>
IndexRequest
.-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
Modifier and Type Method Description IndexRequest<TDocument>
build()
Builds aIndexRequest
.IndexRequest.Builder<TDocument>
document(TDocument value)
Required - Request body.IndexRequest.Builder<TDocument>
id(java.lang.String value)
Document IDIndexRequest.Builder<TDocument>
ifPrimaryTerm(java.lang.Long value)
only perform the index operation if the last operation that has changed the document has the specified primary termIndexRequest.Builder<TDocument>
ifSeqNo(java.lang.Long value)
only perform the index operation if the last operation that has changed the document has the specified sequence numberIndexRequest.Builder<TDocument>
index(java.lang.String value)
Required - The name of the indexIndexRequest.Builder<TDocument>
opType(OpType value)
Explicit operation type.IndexRequest.Builder<TDocument>
pipeline(java.lang.String value)
The pipeline id to preprocess incoming documents withIndexRequest.Builder<TDocument>
refresh(Refresh value)
Iftrue
then refresh 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
(the default) then do nothing with refreshes.IndexRequest.Builder<TDocument>
requireAlias(java.lang.Boolean value)
When true, requires destination to be an alias.IndexRequest.Builder<TDocument>
routing(java.lang.String value)
Specific routing valueprotected IndexRequest.Builder<TDocument>
self()
IndexRequest.Builder<TDocument>
tDocumentSerializer(JsonpSerializer<TDocument> value)
Serializer for TDocument.IndexRequest.Builder<TDocument>
timeout(Time value)
Explicit operation timeoutIndexRequest.Builder<TDocument>
timeout(java.util.function.Function<Time.Builder,ObjectBuilder<Time>> fn)
Explicit operation timeoutIndexRequest.Builder<TDocument>
version(java.lang.Long value)
Explicit version number for concurrency controlIndexRequest.Builder<TDocument>
versionType(VersionType value)
Specific version typeIndexRequest.Builder<TDocument>
waitForActiveShards(WaitForActiveShards value)
Sets the number of shard copies that must be active before proceeding with the index operation.IndexRequest.Builder<TDocument>
waitForActiveShards(java.util.function.Function<WaitForActiveShards.Builder,ObjectBuilder<WaitForActiveShards>> fn)
Sets the number of shard copies that must be active before proceeding with the index operation.IndexRequest.Builder<TDocument>
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
id
Document IDAPI name:
id
-
ifPrimaryTerm
only perform the index operation if the last operation that has changed the document has the specified primary termAPI name:
if_primary_term
-
ifSeqNo
only perform the index operation if the last operation that has changed the document has the specified sequence numberAPI name:
if_seq_no
-
index
Required - The name of the indexAPI name:
index
-
opType
Explicit operation type. Defaults toindex
for requests with an explicit document ID, and tocreate
for requests without an explicit document IDAPI name:
op_type
-
pipeline
The pipeline id to preprocess incoming documents withAPI name:
pipeline
-
refresh
Iftrue
then refresh 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
(the default) then do nothing with refreshes.API name:
refresh
-
requireAlias
When true, requires destination to be an alias. Default is falseAPI name:
require_alias
-
routing
Specific routing valueAPI name:
routing
-
timeout
Explicit operation timeoutAPI name:
timeout
-
timeout
public final IndexRequest.Builder<TDocument> timeout(java.util.function.Function<Time.Builder,ObjectBuilder<Time>> fn)Explicit operation timeoutAPI name:
timeout
-
version
Explicit version number for concurrency controlAPI name:
version
-
versionType
Specific version typeAPI name:
version_type
-
waitForActiveShards
public final IndexRequest.Builder<TDocument> waitForActiveShards(@Nullable WaitForActiveShards value)Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set toall
for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)API name:
wait_for_active_shards
-
waitForActiveShards
public final IndexRequest.Builder<TDocument> waitForActiveShards(java.util.function.Function<WaitForActiveShards.Builder,ObjectBuilder<WaitForActiveShards>> fn)Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set toall
for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (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 classWithJsonObjectBuilderBase<IndexRequest.Builder<TDocument>>
-
build
Builds aIndexRequest
.- Specified by:
build
in interfaceObjectBuilder<TDocument>
- Throws:
java.lang.NullPointerException
- if some of the required fields are null.
-