Class CreateRequest<TDocument>
Request for Create
https://opensearch.org/docs/latest/api-reference/document-apis/index-document/
Inheritance
Implements
Inherited Members
Namespace: OpenSearch.Client
Assembly: OpenSearch.Client.dll
Syntax
public class CreateRequest<TDocument> : PlainRequestBase<CreateRequestParameters>, ICreateRequest<TDocument>, IProxyRequest, IDocumentRequest, IRequest<CreateRequestParameters>, IRequest where TDocument : class
Type Parameters
| Name | Description |
|---|---|
| TDocument |
Constructors
| Edit this page View SourceCreateRequest()
Used for serialization purposes, making sure we have a parameterless constructor
Declaration
protected CreateRequest()
CreateRequest(Id)
/{index}/_create/{id}
Declaration
public CreateRequest(Id id)
Parameters
| Type | Name | Description |
|---|---|---|
| Id | id | this parameter is required |
CreateRequest(IndexName, Id)
/{index}/_create/{id}
Declaration
public CreateRequest(IndexName index, Id id)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexName | index | this parameter is required |
| Id | id | this parameter is required |
CreateRequest(TDocument, IndexName, Id)
/{index}/_create/{id}
Declaration
public CreateRequest(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 |
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.
Declaration
public string Pipeline { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Refresh
If true, OpenSearch refreshes 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 do nothing with refreshes. Valid values: true, false,
wait_for.
Declaration
public Refresh? Refresh { get; set; }
Property Value
| Type | Description |
|---|---|
| Refresh? |
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 OpenSearch.Client 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 ICreateRequest<TDocument> Self { get; }
Property Value
| Type | Description |
|---|---|
| ICreateRequest<TDocument> |
Timeout
Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.
Declaration
public Time Timeout { get; set; }
Property Value
| Type | Description |
|---|---|
| Time |
Version
Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.
Declaration
public long? Version { get; set; }
Property Value
| Type | Description |
|---|---|
| long? |
VersionType
The specific version type: external, external_gte.
Declaration
public VersionType? VersionType { get; set; }
Property Value
| Type | Description |
|---|---|
| VersionType? |
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).
Declaration
public string WaitForActiveShards { get; set; }
Property Value
| Type | Description |
|---|---|
| string |