Skip to content

Conversation

@ChinmayBansal
Copy link
Contributor

Related Issues

Proposed Changes:

Added delete_all_documents() method to AzureAISearchDocumentStore with optional index recreation capability.

Implementation details:

  • Follows the reference implementation from OpenSearch DocumentStore PR feat: adding the operation delete_all_documents to the OpenSearchDocumentStore #2321
  • Supports two deletion strategies via recreate_index parameter:
    • Default (recreate_index=False): Deletes all documents while preserving index (no downtime)
    • Optional (recreate_index=True): Deletes and recreates index with original schema (faster but causes brief downtime)
  • Uses Azure Search Client's native delete_documents() and delete_index()/create_index() APIs
  • Proper error handling and logging

Side effects addressed:

  • Index recreation causes brief downtime but is faster for large datasets
  • Document-level deletion preserves index availability but may hit pagination limits for very large indexes (currently supports up to 100,000 documents in single query)

Files changed:

How did you test it?

  • Linter: hatch run fmt - All checks passed (16 files unchanged)
  • Type checks: hatch run test:types - No issues found
  • Unit tests: hatch run test:unit - 24 passed
  • Integration tests: Added 2 integration tests:
    • test_delete_all_documents: Verifies deletion of multiple documents
    • test_delete_all_documents_empty_index: Verifies behavior with empty index

Notes for the reviewer

  • Implementation follows OpenSearch PR feat: adding the operation delete_all_documents to the OpenSearchDocumentStore #2321 pattern (reference for parent issue #8508)
  • The recreate_index parameter addresses the side effects mentioned in the issue
  • Default behavior (recreate_index=False) is safer for production as it avoids downtime
  • Used Azure's native SearchIndexClient for index operations and SearchClient for document operations
  • Pagination limit of 100,000 documents should be sufficient for most use cases; can be adjusted if needed

Checklist

@ChinmayBansal ChinmayBansal requested a review from a team as a code owner October 18, 2025 19:25
@ChinmayBansal ChinmayBansal requested review from julian-risch and removed request for a team October 18, 2025 19:25
@github-actions github-actions bot added integration:azure-ai-search type:documentation Improvements or additions to documentation labels Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:azure-ai-search type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add delete_all_documents() operation to AzureAISearchDocumentStore

1 participant