Add delete_where() API for bulk index deletion by filter
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Python
- Stars
- 427
- Forks
- 101
- Avg merge
- 6d 3h
- Merged PRs (30d)
- 20
Description
Summary
Add delete_where() / adelete_where() to delete index documents by filter expression, and refactor clear() to share the same internals.
Level: Intermediate
Current State
clear()deletes all documents via batchedFilterQuery("*")flow.drop_documents()/drop_keys()only delete known IDs/keys.- There is no public API to delete a filtered subset of index documents.
Proposed Change
- Add:
delete_where(filter_expression, batch_size=500) -> intadelete_where(filter_expression, batch_size=500) -> int
- Refactor both
clear()anddelete_where()to use shared private internals:- common batch-ID fetch loop
- existing
_delete_batch()and async equivalent as delete primitive
- Implement
clear()asdelete_where(FilterExpression("*")).
Definition of Done
- Filtered bulk deletion works on standalone and cluster clients.
clear()delegates to the shared deletion internals (no duplicated batch loop).- Integration tests cover selective match, no-op match, and full-clear behavior.
- Docs include one usage example.
Out of Scope
- Hard-delete audit logging or soft-delete support.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing clear(), drop_documents(), drop_keys(), and _delete_batch() entry points, including their async equivalents. Run the integration tests for deletion behavior first, then cover selective matches, no-op matches, and full clears for standalone and cluster clients. Done means both new APIs work, clear() shares the deletion internals, and the docs contain one usage example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, redis
- Domain
- backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100