Skip to content

Python: fix(azure_ai_search): use storage_name aliases in hybrid_search - #14689

Open
MOHAMMED WASIM KHAN (wasim-builds) wants to merge 1 commit into
microsoft:mainfrom
wasim-builds:fix/azure-ai-search-hybrid-storage-names
Open

MOHAMMED WASIM KHAN (wasim-builds) wants to merge 1 commit into
microsoft:mainfrom
wasim-builds:fix/azure-ai-search-hybrid-storage-names

Conversation

@wasim-builds

Copy link
Copy Markdown
Contributor

Motivation and Context

Closes #14684

When data and vector fields define storage_name aliases (e.g. content -> body, embedding -> vec), Azure AI Search indexes are created using the storage names. However, AzureAISearchCollection.hybrid_search() was using field.name / vector_field.name instead of storage_name or name when configuring search_fields and vector_queries[0].fields. As a result, Azure AI Search rejected the hybrid search request with a 400 unknown field error because the emitted request referenced model property names not present in the index.

In contrast, SearchType.VECTOR correctly uses vector_field.storage_name or vector_field.name.

Description

  • In AzureAISearchCollection._inner_search for SearchType.KEYWORD_HYBRID:
    • When options.additional_property_name is specified, resolve it to the field's storage_name or name if it matches a model field name or storage name alias.
    • When options.additional_property_name is omitted, collect field.storage_name or field.name for all full-text indexed data fields.
    • In both VectorizedQuery and VectorizableTextQuery, configure fields=vector_field.storage_name or vector_field.name if vector_field else None, matching the vector search branch.
  • Added comprehensive unit tests in test_azure_ai_search.py asserting that hybrid search and vector search correctly use storage name aliases for search fields and vector query fields.

Contribution Checklist

Copilot AI balanced review requested due to automatic review settings October 30, 2026 05:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@semantic-kernel-automation semantic-kernel-automation Bot added the python Pull requests for the Python Semantic Kernel label Oct 30, 2026

This branch was successfully deployed

1 active deployment
github-app-auth — eb2f45b5 Deployed Oct 30, 2026 by wasim-builds via add_label #29499
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: Bug: AzureAISearchCollection.hybrid_search sends declared field names instead of storage_name aliases

2 participants