Condividi tramite


DocumentsOperationsExtensions.IndexAsync Method

Definition

Overloads

IndexAsync(IDocumentsOperations, IndexBatch<Document>, SearchRequestOptions, CancellationToken)

Sends a batch of upload, merge, and/or delete actions to the search index. https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents

IndexAsync<T>(IDocumentsOperations, IndexBatch<T>, SearchRequestOptions, CancellationToken)

Sends a batch of upload, merge, and/or delete actions to the search index. https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents

IndexAsync(IDocumentsOperations, IndexBatch<Document>, SearchRequestOptions, CancellationToken)

Source:
DocumentsOperationsExtensions.cs

Sends a batch of upload, merge, and/or delete actions to the search index. https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents

public static System.Threading.Tasks.Task<Microsoft.Azure.Search.Models.DocumentIndexResult> IndexAsync (this Microsoft.Azure.Search.IDocumentsOperations operations, Microsoft.Azure.Search.Models.IndexBatch<Microsoft.Azure.Search.Models.Document> batch, Microsoft.Azure.Search.Models.SearchRequestOptions searchRequestOptions = default, System.Threading.CancellationToken cancellationToken = default);
static member IndexAsync : Microsoft.Azure.Search.IDocumentsOperations * Microsoft.Azure.Search.Models.IndexBatch<Microsoft.Azure.Search.Models.Document> * Microsoft.Azure.Search.Models.SearchRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Search.Models.DocumentIndexResult>
<Extension()>
Public Function IndexAsync (operations As IDocumentsOperations, batch As IndexBatch(Of Document), Optional searchRequestOptions As SearchRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DocumentIndexResult)

Parameters

operations
IDocumentsOperations

The operations group for this extension method.

batch
IndexBatch<Document>

The batch of index actions.

searchRequestOptions
SearchRequestOptions

Additional parameters for the operation

cancellationToken
CancellationToken

The cancellation token.

Returns

Response containing the status of operations for all actions in the batch.

Exceptions

Thrown when some of the indexing actions failed, but other actions succeeded and modified the state of the index. This can happen when the Search Service is under heavy indexing load. It is important to explicitly catch this exception and check its IndexResult property. This property reports the status of each indexing action in the batch, making it possible to determine the state of the index after a partial failure.

Remarks

The non-generic overloads of the Index, IndexAsync, and IndexWithHttpMessagesAsync methods make a best-effort attempt to map JSON types in the response payload to .NET types. See GetWithHttpMessagesAsync(String, IEnumerable<String>, SearchRequestOptions, Dictionary<String,List<String>>, CancellationToken) for more information.

Applies to

IndexAsync<T>(IDocumentsOperations, IndexBatch<T>, SearchRequestOptions, CancellationToken)

Source:
DocumentsOperationsExtensions.cs

Sends a batch of upload, merge, and/or delete actions to the search index. https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents

public static System.Threading.Tasks.Task<Microsoft.Azure.Search.Models.DocumentIndexResult> IndexAsync<T> (this Microsoft.Azure.Search.IDocumentsOperations operations, Microsoft.Azure.Search.Models.IndexBatch<T> batch, Microsoft.Azure.Search.Models.SearchRequestOptions searchRequestOptions = default, System.Threading.CancellationToken cancellationToken = default);
static member IndexAsync : Microsoft.Azure.Search.IDocumentsOperations * Microsoft.Azure.Search.Models.IndexBatch<'T> * Microsoft.Azure.Search.Models.SearchRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Search.Models.DocumentIndexResult>
<Extension()>
Public Function IndexAsync(Of T) (operations As IDocumentsOperations, batch As IndexBatch(Of T), Optional searchRequestOptions As SearchRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DocumentIndexResult)

Type Parameters

T

The CLR type that maps to the index schema. Instances of this type can be stored as documents in the index.

Parameters

operations
IDocumentsOperations

The operations group for this extension method.

batch
IndexBatch<T>

The batch of index actions.

searchRequestOptions
SearchRequestOptions

Additional parameters for the operation

cancellationToken
CancellationToken

The cancellation token.

Returns

Response containing the status of operations for all actions in the batch.

Exceptions

Thrown when some of the indexing actions failed, but other actions succeeded and modified the state of the index. This can happen when the Search Service is under heavy indexing load. It is important to explicitly catch this exception and check its IndexResult property. This property reports the status of each indexing action in the batch, making it possible to determine the state of the index after a partial failure.

Remarks

The generic overloads of the Index and IndexAsync methods support mapping of search field types to .NET types via the type parameter T. See GetWithHttpMessagesAsync<T>(String, IEnumerable<String>, SearchRequestOptions, Dictionary<String,List<String>>, CancellationToken) for more details on the type mapping.

Applies to