共用方式為


IDocumentsOperations.IndexWithHttpMessagesAsync Method

Definition

Overloads

IndexWithHttpMessagesAsync(IndexBatch<Document>, SearchRequestOptions, Dictionary<String,List<String>>, 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

IndexWithHttpMessagesAsync<T>(IndexBatch<T>, SearchRequestOptions, Dictionary<String,List<String>>, 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

IndexWithHttpMessagesAsync(IndexBatch<Document>, SearchRequestOptions, Dictionary<String,List<String>>, 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

public System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.Search.Models.DocumentIndexResult>> IndexWithHttpMessagesAsync (Microsoft.Azure.Search.Models.IndexBatch<Microsoft.Azure.Search.Models.Document> batch, Microsoft.Azure.Search.Models.SearchRequestOptions searchRequestOptions = default, System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>> customHeaders = default, System.Threading.CancellationToken cancellationToken = default);
abstract member IndexWithHttpMessagesAsync : Microsoft.Azure.Search.Models.IndexBatch<Microsoft.Azure.Search.Models.Document> * Microsoft.Azure.Search.Models.SearchRequestOptions * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.Search.Models.DocumentIndexResult>>
Public Function IndexWithHttpMessagesAsync (batch As IndexBatch(Of Document), Optional searchRequestOptions As SearchRequestOptions = Nothing, Optional customHeaders As Dictionary(Of String, List(Of String)) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of AzureOperationResponse(Of DocumentIndexResult))

Parameters

batch
IndexBatch<Document>

The batch of index actions.

searchRequestOptions
SearchRequestOptions

Additional parameters for the operation

customHeaders
Dictionary<String,List<String>>

The headers that will be added to request.

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

IndexWithHttpMessagesAsync<T>(IndexBatch<T>, SearchRequestOptions, Dictionary<String,List<String>>, 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

public System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.Search.Models.DocumentIndexResult>> IndexWithHttpMessagesAsync<T> (Microsoft.Azure.Search.Models.IndexBatch<T> batch, Microsoft.Azure.Search.Models.SearchRequestOptions searchRequestOptions = default, System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>> customHeaders = default, System.Threading.CancellationToken cancellationToken = default);
abstract member IndexWithHttpMessagesAsync : Microsoft.Azure.Search.Models.IndexBatch<'T> * Microsoft.Azure.Search.Models.SearchRequestOptions * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.Search.Models.DocumentIndexResult>>
Public Function IndexWithHttpMessagesAsync(Of T) (batch As IndexBatch(Of T), Optional searchRequestOptions As SearchRequestOptions = Nothing, Optional customHeaders As Dictionary(Of String, List(Of String)) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of AzureOperationResponse(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

batch
IndexBatch<T>

The batch of index actions.

searchRequestOptions
SearchRequestOptions

Additional parameters for the operation

customHeaders
Dictionary<String,List<String>>

The headers that will be added to request.

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, IndexAsync, and IndexWithHttpMessagesAsync 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