Skip to content

fix: Azure AI Search - return all documents from filter_documents whe… - #4277

Open
davidsbatista wants to merge 2 commits into
mainfrom
fix/azure-ai-search-filter-documents-all-results
Open

davidsbatista wants to merge 2 commits into
mainfrom
fix/azure-ai-search-filter-documents-all-results

Conversation

@davidsbatista

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

When called with no filters, AzureAISearchDocumentStore.filter_documents() fell back to search_documents(), which defaults to top_k=10. So it returned at most 10 documents no matter how many were in the index.

filter_documents() now makes a single client.search(search_text="*", filter=...) call for both cases (with or without filters) and passes no top. The SDK pager then keeps following the service's continuation tokens until every match is returned.

Azure AI Search pages with $skip, which is capped at 100,000. When the result count reaches that limit, a warning is logged saying the result may be incomplete and suggesting a narrower filter. The docstring says the same.

search_documents() is unchanged.

How did you test it?

  • no filters: all documents are returned and no top is sent
  • with filters: no top is sent and the filter is passed through
  • a warning is logged when 100,000 results are returned

@github-actions github-actions Bot added integration:azure-ai-search type:documentation Improvements or additions to documentation labels Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report (azure_ai_search)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/azure_ai_search/src/haystack_integrations/document_stores/azure_ai_search
  document_store.py
Project Total  

This report was generated by python-coverage-comment-action

@davidsbatista
davidsbatista marked this pull request as ready for review November 16, 2026 15:20
@davidsbatista
davidsbatista requested a review from a team as a code owner November 16, 2026 15:20
@davidsbatista
davidsbatista requested review from bogdankostic and removed request for a team November 16, 2026 15:20

This branch has not been deployed

No deployments
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.

1 participant