Skip to main content
This page documents an earlier version of the API client. For the latest version, see Delete records matching a filter.
Required ACL: deleteIndex
  • The filter must be included in your attributesForFaceting. For more information, see Define filterable attributes.
  • This operation counts as 1 operation, even if you delete more than one record.
  • This method is subject to rate-limiting. If you get errors when using this method, check if you’re over the rate limit and wait before sending further indexing requests.
    • If you have more than 100 pending requests, your requests will be throttled.
    • If you have more than 1,000 pending requests pending, further requests will be rejected.
You should only use this method if you can’t get a list of object IDs of the records you want to delete. It’s more efficient to get a list of object IDs with the browse method, and then delete the records using deleteObjects. For more information, see Should I use the deleteby method for deleting records matching a query?

Limitations

  • The deleteBy operation can’t be run in parallel.
  • This method does not accept empty filters or queries.
When deleting large numbers of records be aware of the rate limitations on these processes and the impact on your analytics data.

Examples

Delete records by filter

var query = new Query { Filters = "category:cars", AroundLatLng = "40.71, -74.01" };

index.DeleteBy(query);

// Asynchronous
await index.DeleteByAsync(query);

Delete records by filter and send extra HTTP headers

var query = new Query { Filters = "category:cars", AroundLatLng = "40.71, -74.01" };

RequestOptions requestOptions = new RequestOptions
{
    Headers = new Dictionary<string,string>{ { "X-Algolia-User-ID", "user123" } }
};

index.DeleteBy(query, requestOptions);

// Asynchronous
await index.DeleteByAsync(query, requestOptions);

Parameters

filterParameters
object
required
An object with one or more of the following parameters:
requestOptions
object
A list of request options to send along with the query.

Response

taskID
integer
The task ID used with the waitTask method.
updatedAt
string
Date at which the indexing job has been created.

Response as JSON

This section shows the JSON response returned by the API. Each API client wraps this response in language-specific objects, so the structure may vary. To view the response, use the getLogs method. Don’t rely on the order of properties—JSON objects don’t preserve key order.
JSON
{
  "updatedAt": "2017-12-29T17:34:12.902Z",
  "taskID": 678,
}
I