Search Results for

    Show / Hide Table of Contents

    Class IndexRequest<TDocument>

    Request for Index

    https://opensearch.org/docs/latest/api-reference/document-apis/index-document/

    Inheritance
    object
    RequestBase<IndexRequestParameters>
    PlainRequestBase<IndexRequestParameters>
    IndexRequest<TDocument>
    Implements
    IIndexRequest<TDocument>
    IProxyRequest
    IDocumentRequest
    IRequest<IndexRequestParameters>
    IRequest
    Inherited Members
    PlainRequestBase<IndexRequestParameters>.RequestConfiguration
    PlainRequestBase<IndexRequestParameters>.ErrorTrace
    PlainRequestBase<IndexRequestParameters>.FilterPath
    PlainRequestBase<IndexRequestParameters>.Human
    PlainRequestBase<IndexRequestParameters>.Pretty
    PlainRequestBase<IndexRequestParameters>.SourceQueryString
    RequestBase<IndexRequestParameters>.RequestState
    RequestBase<IndexRequestParameters>.ContentType
    RequestBase<IndexRequestParameters>.ResolveUrl(RouteValues, IConnectionSettingsValues)
    RequestBase<IndexRequestParameters>.RequestDefaults(IndexRequestParameters)
    RequestBase<IndexRequestParameters>.Q<TOut>(string)
    RequestBase<IndexRequestParameters>.Q(string, object)
    RequestBase<IndexRequestParameters>.SetAcceptHeader(string)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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 Source

    IndexRequest()

    /{index}/_doc

    Declaration
    public IndexRequest()
    | Edit this page View Source

    IndexRequest(Id)

    /{index}/_doc/{id}

    Declaration
    public IndexRequest(Id id)
    Parameters
    Type Name Description
    Id id

    Optional, accepts null

    | Edit this page View Source

    IndexRequest(IndexName)

    /{index}/_doc

    Declaration
    public IndexRequest(IndexName index)
    Parameters
    Type Name Description
    IndexName index

    this parameter is required

    | Edit this page View Source

    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

    | Edit this page View Source

    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 Source

    Document

    Declaration
    public TDocument Document { get; set; }
    Property Value
    Type Description
    TDocument
    | Edit this page View Source

    HttpMethod

    Declaration
    protected override HttpMethod HttpMethod { get; }
    Property Value
    Type Description
    HttpMethod
    Overrides
    RequestBase<IndexRequestParameters>.HttpMethod
    | Edit this page View Source

    IfPrimaryTerm

    Only perform the operation if the document has this primary term.

    Declaration
    public long? IfPrimaryTerm { get; set; }
    Property Value
    Type Description
    long?
    | Edit this page View Source

    IfSequenceNumber

    Only perform the operation if the document has this sequence number.

    Declaration
    public long? IfSequenceNumber { get; set; }
    Property Value
    Type Description
    long?
    | Edit this page View Source

    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 to index. Otherwise, it defaults to create.

    Declaration
    public OpType? OpType { get; set; }
    Property Value
    Type Description
    OpType?
    | Edit this page View Source

    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
    | Edit this page View Source

    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?
    | Edit this page View Source

    RequireAlias

    If true, the destination must be an index alias.

    Declaration
    public bool? RequireAlias { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    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
    | Edit this page View Source

    Self

    Declaration
    protected IIndexRequest<TDocument> Self { get; }
    Property Value
    Type Description
    IIndexRequest<TDocument>
    | Edit this page View Source

    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
    | Edit this page View Source

    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?
    | Edit this page View Source

    VersionType

    Specific version type: external, external_gte.

    Declaration
    public VersionType? VersionType { get; set; }
    Property Value
    Type Description
    VersionType?
    | Edit this page View Source

    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

    Implements

    IIndexRequest<TDocument>
    IProxyRequest
    IDocumentRequest
    IRequest<TParameters>
    IRequest

    Extension Methods

    SuffixExtensions.Suffix(object, string)
    • Edit this page
    • View Source
    In this article
    • Constructors
      • IndexRequest()
      • IndexRequest(Id)
      • IndexRequest(IndexName)
      • IndexRequest(IndexName, Id)
      • IndexRequest(TDocument, IndexName, Id)
    • Properties
      • Document
      • HttpMethod
      • IfPrimaryTerm
      • IfSequenceNumber
      • OpType
      • Pipeline
      • Refresh
      • RequireAlias
      • Routing
      • Self
      • Timeout
      • Version
      • VersionType
      • WaitForActiveShards
    • Implements
    • Extension Methods
    Back to top Generated by DocFX