SDK
SDK C# v2.x
2

MDeleteAsync #

Deletes multiple documents.

Arguments #

Copied to clipboard!
public async Task<JObject> MDeleteAsync(
  string index, 
  string collection, 
  string[] ids, 
  bool waitForRefresh = false);


Argument Type Description
index
string
Index name
collection
string
Collection name
ids
string[]
IDs of the documents to delete
waitForRefresh
bool

(false)
If true, waits for the change to be reflected for search (up to 1s)

Return #

Returns a JObject containing 2 arrays: successes and errors

The successes array contains the successfully deleted document IDs.

Each deletion error is an object of the errors array with the following properties:

Name Type Description
id
String
Document ID
reason
String
Human readable reason
status
int
HTTP status code

Exceptions #

Throws a KuzzleException if there is an error. See how to handle errors.

Usage #

Copied to clipboard!
try {
  JObject response = await kuzzle.Document.MDeleteAsync(
    "nyc-open-data",
    "yellow-taxi",
    new string[] { "some-id", "some-other-id" });
  Console.WriteLine($"Successfully deleted {((JArray)response["successes"]).Count} documents");
} catch (KuzzleException e) {
  Console.Error.WriteLine(e);
}