다음을 통해 공유


SearchClient.DeleteDocumentsAsync Method

Definition

Overloads

DeleteDocumentsAsync(String, IEnumerable<String>, IndexDocumentsOptions, CancellationToken)

Delete documents from the index as a batch given only their keys.

DeleteDocumentsAsync<T>(IEnumerable<T>, IndexDocumentsOptions, CancellationToken)

Delete documents from the index as a batch.

DeleteDocumentsAsync(String, IEnumerable<String>, IndexDocumentsOptions, CancellationToken)

Source:
SearchClient.cs
Source:
SearchClient.cs

Delete documents from the index as a batch given only their keys.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Search.Documents.Models.IndexDocumentsResult>> DeleteDocumentsAsync (string keyName, System.Collections.Generic.IEnumerable<string> keyValues, Azure.Search.Documents.IndexDocumentsOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DeleteDocumentsAsync : string * seq<string> * Azure.Search.Documents.IndexDocumentsOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Search.Documents.Models.IndexDocumentsResult>>
override this.DeleteDocumentsAsync : string * seq<string> * Azure.Search.Documents.IndexDocumentsOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Search.Documents.Models.IndexDocumentsResult>>
Public Overridable Function DeleteDocumentsAsync (keyName As String, keyValues As IEnumerable(Of String), Optional options As IndexDocumentsOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of IndexDocumentsResult))

Parameters

keyName
String

The name of the key field that uniquely identifies documents in the index.

keyValues
IEnumerable<String>

The keys of the documents to delete.

options
IndexDocumentsOptions

Options that allow specifying document indexing behavior.

cancellationToken
CancellationToken

Optional CancellationToken to propagate notifications that the operation should be canceled.

Returns

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

Exceptions

Thrown when a failure is returned by the Search Service.

Remarks

By default, an exception will only be thrown if the entire request fails. Individual failures are described in the Results collection. You can set ThrowOnAnyError if you want exceptions thrown on partial failure.

Applies to

DeleteDocumentsAsync<T>(IEnumerable<T>, IndexDocumentsOptions, CancellationToken)

Source:
SearchClient.cs
Source:
SearchClient.cs

Delete documents from the index as a batch.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Search.Documents.Models.IndexDocumentsResult>> DeleteDocumentsAsync<T> (System.Collections.Generic.IEnumerable<T> documents, Azure.Search.Documents.IndexDocumentsOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DeleteDocumentsAsync : seq<'T> * Azure.Search.Documents.IndexDocumentsOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Search.Documents.Models.IndexDocumentsResult>>
override this.DeleteDocumentsAsync : seq<'T> * Azure.Search.Documents.IndexDocumentsOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Search.Documents.Models.IndexDocumentsResult>>
Public Overridable Function DeleteDocumentsAsync(Of T) (documents As IEnumerable(Of T), Optional options As IndexDocumentsOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of IndexDocumentsResult))

Type Parameters

T

The .NET type that maps to the index schema. Instances of this type can be retrieved as documents from the index.

Parameters

documents
IEnumerable<T>

The documents to delete.

options
IndexDocumentsOptions

Options that allow specifying document indexing behavior.

cancellationToken
CancellationToken

Optional CancellationToken to propagate notifications that the operation should be canceled.

Returns

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

Exceptions

Thrown when a failure is returned by the Search Service.

Remarks

The generic overloads of the DeleteDocuments and DeleteDocumentsAsync methods support mapping of search field types to .NET types via the type parameter T. See GetDocumentAsync<T>(String, GetDocumentOptions, CancellationToken) for more details on the type mapping.

By default, an exception will only be thrown if the entire request fails. Individual failures are described in the Results collection. You can set ThrowOnAnyError if you want exceptions thrown on partial failure.

Applies to