deleteByQuery #
Deletes documents matching the provided search query.
Kuzzle uses the ElasticSearch Query DSL syntax.
An empty or null query will match all documents in the collection.
deleteByQuery(index, collection, [query], [options]);
Argument | Type | Description |
---|---|---|
index | string | Index name |
collection | string | Collection name |
query | object | Query to match |
options | object | Query options |
Options #
Additional query options
Options | Type (default) | Description |
---|---|---|
queuable | boolean ( true ) | If true, queues the request during downtime, until connected to Kuzzle again |
refresh | string ( "" ) | If set to wait_for , waits for the change to be reflected for search (up to 1s) |
Resolves #
Resolves to an array of strings containing the deleted document ids.
Usage #
try {
const deleted = await kuzzle.document.deleteByQuery(
'nyc-open-data',
'yellow-taxi',
{
query: {
term: { capacity: 7 }
}
}
);
console.log(`Successfully deleted ${deleted.length} documents`);
} catch (error) {
console.error(error.message);
}
Edit this page on Github(opens new window)