Class IndexRequest<TDocument>
Request for Index
https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/index-document/
Inheritance
Implements
Inherited Members
Namespace: OpenSearch.Client
Assembly: OpenSearch.Client.dll
Syntax
public class IndexRequest<TDocument> : PlainRequestBase<IndexRequestParameters>, IIndexRequest<TDocument>, IProxyRequest, IDocumentRequest, IRequest<IndexRequestParameters>, IRequest where TDocument : class
Type Parameters
Name | Description |
---|---|
TDocument |
Constructors
| Edit this page View SourceIndexRequest()
/{index}/_doc
Declaration
public IndexRequest()
IndexRequest(Id)
/{index}/_doc/{id}
Declaration
public IndexRequest(Id id)
Parameters
Type | Name | Description |
---|---|---|
Id | id | Optional, accepts null |
IndexRequest(IndexName)
/{index}/_doc
Declaration
public IndexRequest(IndexName index)
Parameters
Type | Name | Description |
---|---|---|
IndexName | index | this parameter is required |
IndexRequest(IndexName, Id)
/{index}/_doc/{id}
Declaration
public IndexRequest(IndexName index, Id id)
Parameters
Type | Name | Description |
---|---|---|
IndexName | index | this parameter is required |
Id | id | Optional, accepts null |
IndexRequest(TDocument, IndexName, Id)
/{index}/_doc/{id}
Declaration
public IndexRequest(TDocument documentWithId, IndexName index = null, Id id = null)
Parameters
Type | Name | Description |
---|---|---|
TDocument | documentWithId | |
IndexName | index | |
Id | id | The document used to resolve the path from |
Properties
| Edit this page View SourceDocument
Declaration
public TDocument Document { get; set; }
Property Value
Type | Description |
---|---|
TDocument |
HttpMethod
Declaration
protected override HttpMethod HttpMethod { get; }
Property Value
Type | Description |
---|---|
HttpMethod |
Overrides
| Edit this page View SourceIfPrimaryTerm
only perform the index operation if the last operation that has changed the document has the specified primary term
Declaration
public long? IfPrimaryTerm { get; set; }
Property Value
Type | Description |
---|---|
long? |
IfSequenceNumber
only perform the index operation if the last operation that has changed the document has the specified sequence number
Declaration
public long? IfSequenceNumber { get; set; }
Property Value
Type | Description |
---|---|
long? |
OpType
Explicit operation type. Defaults to index
for requests with an explicit document ID, and to create
for requests without an explicit
document ID
Declaration
public OpType? OpType { get; set; }
Property Value
Type | Description |
---|---|
OpType? |
Pipeline
The pipeline id to preprocess incoming documents with
Declaration
public string Pipeline { get; set; }
Property Value
Type | Description |
---|---|
string |
Refresh
If true
then refresh the affected shards to make this operation visible to search, if wait_for
then wait for a refresh to make this
operation visible to search, if false
(the default) then do nothing with refreshes.
Declaration
public Refresh? Refresh { get; set; }
Property Value
Type | Description |
---|---|
Refresh? |
RequireAlias
When true, requires destination to be an alias. Default is false
Declaration
public bool? RequireAlias { get; set; }
Property Value
Type | Description |
---|---|
bool? |
Routing
A document is routed to a particular shard in an index using the following formula
shard_num = hash(_routing) % num_primary_shards
OpenSearch will use the document id if not provided.
For requests that are constructed from/for a document OSC will automatically infer the routing key if that document has a JoinField or a routing mapping on for its type exists on ConnectionSettings
Declaration
public Routing Routing { get; set; }
Property Value
Type | Description |
---|---|
Routing |
Self
Declaration
protected IIndexRequest<TDocument> Self { get; }
Property Value
Type | Description |
---|---|
IIndexRequest<TDocument> |
Timeout
Explicit operation timeout
Declaration
public Time Timeout { get; set; }
Property Value
Type | Description |
---|---|
Time |
Version
Explicit version number for concurrency control
Declaration
public long? Version { get; set; }
Property Value
Type | Description |
---|---|
long? |
VersionType
Specific version type
Declaration
public VersionType? VersionType { get; set; }
Property Value
Type | Description |
---|---|
VersionType? |
WaitForActiveShards
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 to all
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)
Declaration
public string WaitForActiveShards { get; set; }
Property Value
Type | Description |
---|---|
string |