SDK
SDK C# v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

DeleteByQueryAsync #

Deletes documents matching the provided search query.

Kuzzle uses the ElasticSearch Query DSL syntax.

Arguments #

public async Task<JArray> DeleteByQueryAsync(
  string index, 
  string collection, 
  JObject query);

ArgumentTypeDescription
index
string
Index name
collection
string
Collection name
query
JObject
JObject representing the query to match

Return #

A JArray containing the IDs of deleted documents.

Exceptions #

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

Usage #

try {
  JArray ids =
    await kuzzle.Document.DeleteByQueryAsync(
      "nyc-open-data",
      "yellow-taxi",
      JObject.Parse(@"{
        ""query"": {
          ""term"": {
            ""capacity"": 7
          }
        }
      }"));
  Console.WriteLine($"Successfully deleted {ids.Count} documents");
} catch (KuzzleException e) {
  Console.Error.WriteLine(e);
}