Class IndexRequest.Builder<TDocument>
- All Implemented Interfaces:
- WithJson<IndexRequest.Builder<TDocument>>,- ObjectBuilder<IndexRequest<TDocument>>
- Enclosing class:
- IndexRequest<TDocument>
IndexRequest.- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbuild()Builds aIndexRequest.final IndexRequest.Builder<TDocument>Required - Request body.final IndexRequest.Builder<TDocument>A 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>includeSourceOnError(Boolean value) True or false if to include the document source in the error message in case of parsing errors.final IndexRequest.Builder<TDocument>Required - The name of the data stream or index to target.final IndexRequest.Builder<TDocument>Set tocreateto only index the document if it does not already exist (put if absent).final IndexRequest.Builder<TDocument>The 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.final IndexRequest.Builder<TDocument>requireAlias(Boolean value) Iftrue, the destination must be an index alias.final IndexRequest.Builder<TDocument>requireDataStream(Boolean value) Iftrue, the request's actions must target a data stream (existing or to be created).final IndexRequest.Builder<TDocument>A custom value that is used to route operations to a specific shard.protected IndexRequest.Builder<TDocument>self()final IndexRequest.Builder<TDocument>Serializer for TDocument.final IndexRequest.Builder<TDocument>The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.final IndexRequest.Builder<TDocument>The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.final IndexRequest.Builder<TDocument>An explicit version number for concurrency control.final IndexRequest.Builder<TDocument>versionType(VersionType value) The version type.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- 
Builderpublic Builder()
 
- 
- 
Method Details- 
idA unique identifier for the document. To automatically generate a document ID, use thePOST /<target>/_doc/request format and omit this parameter.API name: id
- 
ifPrimaryTermOnly perform the operation if the document has this primary term.API name: if_primary_term
- 
ifSeqNoOnly perform the operation if the document has this sequence number.API name: if_seq_no
- 
includeSourceOnErrorTrue or false if to include the document source in the error message in case of parsing errors.API name: include_source_on_error
- 
indexRequired - 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_streamdefinition, 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. You can check for existing targets with the resolve index API.API name: index
- 
opTypeSet tocreateto only index the document if it does not already exist (put if absent). If a document with the specified_idalready exists, the indexing operation will fail. The behavior is the same as using the<index>/_createendpoint. If a document ID is specified, this paramater defaults toindex. Otherwise, it defaults tocreate. If the request targets a data stream, anop_typeofcreateis required.API name: op_type
- 
pipelineThe ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to_nonedisables 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
- 
refreshIftrue, 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
- 
requireAliasIftrue, the destination must be an index alias.API name: require_alias
- 
requireDataStreamIftrue, the request's actions must target a data stream (existing or to be created).API name: require_data_stream
- 
routingA custom value that is used to route operations to a specific shard.API name: routing
- 
timeoutThe period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.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
- 
timeoutThe period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.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
- 
versionAn explicit version number for concurrency control. It must be a non-negative long number.API name: version
- 
versionTypeThe version type.API name: version_type
- 
waitForActiveShardspublic final IndexRequest.Builder<TDocument> waitForActiveShards(@Nullable WaitForActiveShards value) The number of shard copies that must be active before proceeding with the operation. You can set it toallor any positive integer up to the total number of shards in the index (number_of_replicas+1). The default value of1means it waits for each primary shard to be active.API name: wait_for_active_shards
- 
waitForActiveShardspublic 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. You can set it toallor any positive integer up to the total number of shards in the index (number_of_replicas+1). The default value of1means it waits for each primary shard to be active.API name: wait_for_active_shards
- 
documentRequired - Request body.
- 
tDocumentSerializerpublic 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.
- 
withJsonpublic IndexRequest.Builder<TDocument> withJson(jakarta.json.stream.JsonParser parser, JsonpMapper mapper) Description copied from interface:WithJsonSets 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 withJsongives 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:
- withJsonin interface- WithJson<TDocument>
- Overrides:
- withJsonin class- WithJsonObjectBuilderBase<IndexRequest.Builder<TDocument>>
- Parameters:
- parser- the JSONP parser
- mapper- the JSONP mapper used to deserialize values and nested objects
- Returns:
- this object
 
- 
self- Specified by:
- selfin class- RequestBase.AbstractBuilder<IndexRequest.Builder<TDocument>>
 
- 
buildBuilds aIndexRequest.- Specified by:
- buildin interface- ObjectBuilder<TDocument>
- Throws:
- NullPointerException- if some of the required fields are null.
 
 
-