IDocumentOperations.IndexAsync Method
Applies To: Microsoft Azure
Namespace: Microsoft.Azure.Search
Assembly: Microsoft.Azure.Search (in Microsoft.Azure.Search.dll)
Overload List
| Name | Description | |
|---|---|---|
![]() |
IndexAsync(IndexBatch, CancellationToken) | Sends a batch of upload, merge, and/or delete actions to the Azure Search index. (see https://msdn.microsoft.com/library/azure/dn798935.aspx for more information) |
![]() |
IndexAsync<T>(IndexBatch<T>, CancellationToken) | Sends a batch of upload, merge, and/or delete actions to the Azure Search index. (see https://msdn.microsoft.com/library/azure/dn798935.aspx for more information) |
See Also
IDocumentOperations Interface
Microsoft.Azure.Search Namespace
Return to top
IDocumentOperations.IndexAsync Method (IndexBatch, CancellationToken)
Sends a batch of upload, merge, and/or delete actions to the Azure Search index. (see https://msdn.microsoft.com/library/azure/dn798935.aspx for more information)
Syntax
Task<DocumentIndexResponse> IndexAsync(
IndexBatch batch,
CancellationToken cancellationToken
)
Task<DocumentIndexResponse^>^ IndexAsync(
IndexBatch^ batch,
CancellationToken cancellationToken
)
abstract IndexAsync :
batch:IndexBatch *
cancellationToken:CancellationToken -> Task<DocumentIndexResponse>
Function IndexAsync (
batch As IndexBatch,
cancellationToken As CancellationToken
) As Task(Of DocumentIndexResponse)
Parameters
batch
Type: Microsoft.Azure.Search.Models.IndexBatchThe batch of index actions.
cancellationToken
Type: System.Threading.CancellationTokenCancellation token.
Return Value
Type: System.Threading.Tasks.Task<DocumentIndexResponse>
Response containing the status of operations for all actions in the batch.
Exceptions
| Exception | Condition |
|---|---|
| IndexBatchException | 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 IndexResponse 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. |
Return to top
IDocumentOperations.IndexAsync<T> Method (IndexBatch<T>, CancellationToken)
Sends a batch of upload, merge, and/or delete actions to the Azure Search index. (see https://msdn.microsoft.com/library/azure/dn798935.aspx for more information)
Syntax
Task<DocumentIndexResponse> IndexAsync<T>(
IndexBatch<T> batch,
CancellationToken cancellationToken
)
where T : class
generic<typename T>
where T : ref class
Task<DocumentIndexResponse^>^ IndexAsync(
IndexBatch<T>^ batch,
CancellationToken cancellationToken
)
abstract IndexAsync<'T when 'T : not struct> :
batch:IndexBatch<'T> *
cancellationToken:CancellationToken -> Task<DocumentIndexResponse>
Function IndexAsync(Of T As Class) (
batch As IndexBatch(Of T),
cancellationToken As CancellationToken
) As Task(Of DocumentIndexResponse)
Parameters
batch
Type: Microsoft.Azure.Search.Models.IndexBatch<T>The batch of index actions.
cancellationToken
Type: System.Threading.CancellationTokenCancellation token.
Return Value
Type: System.Threading.Tasks.Task<DocumentIndexResponse>
Response containing the status of operations for all actions in the batch.
Type Parameters
- T
The CLR type that maps to the index schema. Instances of this type can be stored as documents in the index.
Exceptions
| Exception | Condition |
|---|---|
| IndexBatchException | 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 IndexResponse 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 Azure Search field types to .NET types via the type parameter T. See GetAsync<T> for more details on the type mapping.
Return to top
.jpeg)