Delete By
deleteIndex
ACL
$index->deleteBy(array filterParameters) $index->deleteBy(array filterParameters, array requestOptions)
About this method
You are currently reading the JavaScript API client v4 documentation. Check our migration guide to learn how to upgrade from v3 to v4. You can still access the v3 documentation.
You are currently reading the Ruby API client v2 documentation. Check our migration guide to learn how to upgrade from v1 to v2. You can still access the v1 documentation.
Remove all objects matching a filter (including geo filters).
This method enables you to delete one or more objects based on filters (numeric, facet, tag or geo queries).
It does not accept empty filters or a query.
This method should only be used if you cannot get the list of objectIDs you want to delete; These operations cannot be processed in parallel by the engine. If possible, use the delete method instead which is significantly more performant.
The delete by method only counts as 1 operation - even if it deletes more than one object. This is exceptional; most indexing options that affect more than one object normally count each object as a separate operation.
When sending multiple deleteBy
operations, be aware of our rate limit.
You’ll know you’ve reached the rate limit when you start receiving errors
on your indexing operations.
This can only be resolved if you wait before sending any further indexing operations.
Note this is an expensive operation:
- when you have more than 100 requests pending, your requests will be throttled.
- when you have more than 1000 requests pending, further requests will be rejected.
- if needed, these values can be tuned through configuration.
Examples
Delete records by filter
1
2
3
4
5
$index->deleteBy([
'filters' => 'category:cars',
'aroundLatLng' => '40.71, -74.01'
/* add any filter parameters */
]);
Delete records by filter and send extra HTTP headers
1
2
3
4
5
6
7
8
9
$params = [
'filters' => 'category:cars',
'aroundLatLng' => '40.71, -74.01'
/* add any filter parameters */
];
$index->deleteBy($params, [
'X-Algolia-User-ID' => 'user123'
]);
Parameters
filterParameters
|
type: key/value mapping
Required
An object with one or more of the following parameters:
|
requestOptions
|
type: key/value mapping
default: No request options
Optional
A list of request options to send along with the query. |
Response
In this section we document the JSON response returned by the API. Each language will encapsulate this response inside objects specific to the language and/or the implementation. So the actual type in your language might differ from what is documented.
JSON format
1
2
3
4
{
"updatedAt": "2017-12-29T17:34:12.902Z",
"taskID": 678,
}
updatedAt
|
string
Date at which the indexing job has been created. |
taskID
|
integer
The taskID used with the waitTask method. |