redis / redis/redis-vl-python

Add delete_where() API for bulk index deletion by filter

Open
#488 1 comment 0 reactions 0 assignees View on GitHub

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 batched FilterQuery("*") 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) -> int
    • adelete_where(filter_expression, batch_size=500) -> int
  • Refactor both clear() and delete_where() to use shared private internals:
    • common batch-ID fetch loop
    • existing _delete_batch() and async equivalent as delete primitive
  • Implement clear() as delete_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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.