Delete by filter
Filter-based deletion removes all documents matching a filter expression. This is the most efficient way to delete large sets of documents when they share a common attribute.AND, OR, and comparison operators.
Delete-by-filter tasks cannot be autobatched with other task types. Each delete-by-filter operation is processed as its own individual batch. If you are enqueuing many delete-by-filter tasks alongside other write operations, be aware that this may slow down overall task processing.
Common filter patterns
Delete by category:Delete by batch of IDs
When you know the exact document IDs to remove, send them as an array:Monitor deletion progress
Deletion operations are asynchronous. The response returns ataskUid you can use to track progress:
Choose the right deletion strategy
Delete all documents
To remove every document in an index while keeping the index settings:Plan for regular cleanup
If your data has a natural lifecycle (listings expire, events pass, articles are archived), consider adding a timestamp or status field to your documents and making it filterable:Next steps
Add and update documents
Learn about document add, update, and replace operations
Filter expression reference
Full syntax reference for filter expressions
Async operations
Understand how tasks work in Meilisearch