Delete By | JavaScript API Client V3 (Deprecated)
deleteIndex
ACL
index.deleteBy(object filterParameters, callback)
About this method
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 5000 requests pending, further requests will be ignored.
- 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. |