Class IndexRequest<TDocument>
java.lang.Object
co.elastic.clients.elasticsearch._types.RequestBase
co.elastic.clients.elasticsearch.core.IndexRequest<TDocument>
- All Implemented Interfaces:
JsonpSerializable
@JsonpDeserializable
public class IndexRequest<TDocument>
extends RequestBase
implements JsonpSerializable
Adds a JSON document to the specified data stream or index and makes it
searchable. If the target is an index and the document already exists, the
request updates the document and increments its version.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class co.elastic.clients.elasticsearch._types.RequestBase
RequestBase.AbstractBuilder<BuilderT extends RequestBase.AbstractBuilder<BuilderT>>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final JsonpDeserializer<IndexRequest<Object>>
Json deserializer forIndexRequest
based on named deserializers provided by the callingJsonMapper
.static final Endpoint<IndexRequest<?>,
IndexResponse, ErrorResponse> Endpoint "index
". -
Method Summary
Modifier and TypeMethodDescriptionstatic <TDocument>
JsonpDeserializer<IndexRequest<TDocument>>createIndexRequestDeserializer
(JsonpDeserializer<TDocument> tDocumentDeserializer) final TDocument
document()
Required - Request body.final String
id()
Unique identifier for the document.final Long
Only perform the operation if the document has this primary term.final Long
ifSeqNo()
Only perform the operation if the document has this sequence number.final String
index()
Required - Name of the data stream or index to target.static <TDocument>
IndexRequest<TDocument>of
(Function<IndexRequest.Builder<TDocument>, ObjectBuilder<IndexRequest<TDocument>>> fn) final OpType
opType()
Set to create to only index the document if it does not already exist (put if absent).final String
pipeline()
ID of the pipeline to use to preprocess incoming documents.final Refresh
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.final Boolean
Iftrue
, the destination must be an index alias.final String
routing()
Custom value used to route operations to a specific shard.void
serialize
(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize this value to JSON.final Time
timeout()
Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.final Long
version()
Explicit version number for concurrency control.final VersionType
Specific version type:external
,external_gte
.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 forIndexRequest
based on named deserializers provided by the callingJsonMapper
. -
_ENDPOINT
Endpoint "index
".
-
-
Method Details
-
of
public static <TDocument> IndexRequest<TDocument> of(Function<IndexRequest.Builder<TDocument>, ObjectBuilder<IndexRequest<TDocument>>> fn) -
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
-
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
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. -
serialize
Serialize this value to JSON.- Specified by:
serialize
in interfaceJsonpSerializable
-
createIndexRequestDeserializer
public static <TDocument> JsonpDeserializer<IndexRequest<TDocument>> createIndexRequestDeserializer(JsonpDeserializer<TDocument> tDocumentDeserializer)
-