Skip to content

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

Closed

Description

@BlueX888

Describe the bug

AzureAISearchCollection.hybrid_search() sends the model's declared field names instead of their storage_name aliases. When a field declares storage_name, the index is created with the storage names, so the hybrid request references fields the index does not contain and Azure AI Search rejects it (400 unknown field).

Index field names created by ensure_collection_exists: ['doc_id', 'body', 'vec']
hybrid_search search_fields   : ['content']
hybrid_search vector fields   : embedding
vector search vector fields   : vec

Root cause: the hybrid branch uses field.name / vector_field.name (python/semantic_kernel/connectors/azure_ai_search.py:602, :616, :623), while the vector branch (:572, :582, :589) correctly uses storage_name or name. The index creation path also uses the storage names (:235, :269).

To Reproduce

With a model whose content field declares storage_name="body" and whose embedding field declares storage_name="vec":

  1. Call ensure_collection_exists() — the index is created with doc_id, body, vec.
  2. Call hybrid_search(...) — the emitted request uses search_fields=['content'] and vector_queries[0].fields='embedding'.
  3. Call search(vector=...) — the vector-only request correctly uses vec.

A self-contained script that captures the request objects (no live service) prints the three lines above; run from python/:

.venv/Scripts/python.exe -I repro_azure_ai_search_hybrid_storage_names.py

Requires azure-search-documents>=11.6.0b4,<13.0.0 (the connector's own dependency).

Expected behavior

hybrid_search() should use storage_name or name for search_fields and vector fields, matching both the index definition and the vector-only search path (body/vec above).

Platform

  • Language: Python
  • Source: main branch at 4bb64ee (2026-10-28), semantic-kernel 1.46.0
  • AI model: n/a (request construction only)
  • OS: Windows 11

Additional context

Reported with AI assistance (analysis and reproduction script); the reporter ran the reproduction and verified the output above.

Activity

  1. changed the title [-]Bug: AzureAISearchCollection.hybrid_search sends declared field names instead of storage_name aliases[/-] [+]Python: Bug: AzureAISearchCollection.hybrid_search sends declared field names instead of storage_name aliases[/+] on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pythonPull requests for the Python Semantic Kerneltriage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions