-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Update search samples #44795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update search samples #44795
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refreshes the Azure Search Python samples to align with the latest 2025-11-01-preview API, updated index schemas (PascalCase fields), and new capabilities like vector search, semantic search, and knowledge bases. It also consolidates and modernizes CRUD and indexing examples, introducing clearer naming and more realistic end-to-end workflows.
Changes:
- Replace older “_operations” and “_query” samples with a new, more consistent set (
sample_query_*,sample_index_*,sample_documents_*) using updated field casing and modern patterns. - Introduce dedicated samples for vector search, semantic search, agentic retrieval, indexer workflows, and custom HTTP requests, both sync and async, reusing a shared
AZURE_SEARCH_API_VERSIONconstant. - Remove legacy samples and data files that duplicated functionality or referenced outdated field names, replacing them with new
data/assets where needed (e.g., synonym map and query vector JSON).
Reviewed changes
Copilot reviewed 80 out of 82 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
samples/sample_vector_search.py |
Removed legacy vector search sample; replaced by new sample_query_vector.py pattern. |
samples/sample_utils.py |
Adds AZURE_SEARCH_API_VERSION = "2025-11-01-preview" constant for reuse in custom-request samples. |
samples/sample_synonym_map_operations.py |
Removes older synonym map CRUD sample in favor of sample_index_synonym_map_crud.py. |
samples/sample_suggestions.py |
Removes older suggestions sample; behavior now covered by sample_query_suggestions.py. |
samples/sample_simple_query.py |
Removes older simple text query sample; replaced by sample_query_simple.py. |
samples/sample_semantic_search.py |
Removes older semantic search sample; replaced by sample_query_semantic.py. |
samples/sample_search_client_send_request.py |
Removes older custom-request sample hardcoding a specific API version. |
samples/sample_search_client_custom_request.py |
New sample showing sync SearchClient.send_request using AZURE_SEARCH_API_VERSION and printing document count. |
samples/sample_query_vector.py |
New end-to-end vector search sample: creates a vector-enabled index, uploads docs with precomputed vectors, and runs vector-only and hybrid queries. |
samples/sample_query_suggestions.py |
New sync suggestion sample using PascalCase fields (HotelId, HotelName) consistent with updated index schema. |
samples/sample_query_simple.py |
New sync simple text search sample using updated field casing (HotelName, Rating). |
samples/sample_query_session.py |
Updates description, environment variable docs, and output to use PascalCase fields and clearer result text for session-based scoring. |
samples/sample_query_semantic.py |
New sync semantic search sample that configures SemanticSearch on the index and demonstrates speller and semantic ranking. |
samples/sample_query_filter.py |
New sync filtered + ordered query sample using updated field names (HotelName, Rating, Address/StateProvince). |
samples/sample_query_facets.py |
New sync facet retrieval sample using PascalCase facet fields (Category, ParkingIncluded). |
samples/sample_query_autocomplete.py |
Modernizes autocomplete sample description, env var docs, and output formatting (Completion: ...). |
samples/sample_indexers_operations.py |
Removes older indexer CRUD sample; functionality superseded by sample_indexer_crud.py and sample_indexer_workflow.py. |
samples/sample_indexer_workflow.py |
New comprehensive sync sample that creates index, data source, skillset, indexer, schedules it, and cleans up related resources. |
samples/sample_indexer_datasource_skillset.py |
Removes older combined indexer/data source/skillset workflow in favor of clearer new workflow/data source CRUD samples. |
samples/sample_indexer_datasource_crud.py |
New sync sample focused solely on data source CRUD operations. |
samples/sample_indexer_crud.py |
New sync sample focused solely on indexer CRUD (create, list, get, status, run, reset, delete) and cleanup. |
samples/sample_index_synonym_map_crud.py |
New sync synonym map CRUD sample including file-based creation via data/synonym_map.txt. |
samples/sample_index_crud_operations.py |
Removes older index CRUD sample using lower-case field names. |
samples/sample_index_crud.py |
New sync index CRUD sample using PascalCase field names and explicit index_name. |
samples/sample_index_client_send_request.py |
Removes old index client custom-request sample using a baked-in preview API version. |
samples/sample_index_client_custom_request.py |
New sync SearchIndexClient.send_request sample, parameterized via AZURE_SEARCH_API_VERSION. |
samples/sample_index_analyze_text.py |
New sync sample demonstrating SearchIndexClient.analyze_text with AnalyzeTextOptions and token-level output. |
samples/sample_index_alias_crud_operations.py |
Removes older alias CRUD sample; behavior now in sample_index_alias_crud.py. |
samples/sample_index_alias_crud.py |
New sync index alias CRUD sample with a clearer alias name and index versioning example (v2). |
samples/sample_get_document.py |
Removes standalone get-document sample; equivalent behavior added to sample_documents_crud.py. |
samples/sample_filter_query.py |
Removes older filter + order-by sample with lower-case field names. |
samples/sample_facet_query.py |
Removes older facet sample that used lower-case facet names and manual casting. |
samples/sample_documents_crud.py |
New sync document CRUD sample (upload, merge, get, delete) using updated hotel schema and geospatial location. |
samples/sample_documents_buffered_sender.py |
New sync SearchIndexingBufferedSender sample showing upload/merge/delete actions on a single document. |
samples/sample_data_source_operations.py |
Removes older data source CRUD sample in favor of sample_indexer_datasource_crud.py. |
samples/sample_crud_operations.py |
Removes older minimal document CRUD sample with lower-case field names. |
samples/sample_buffered_sender.py |
Removes older buffered sender sample; superseded by sample_documents_buffered_sender.py. |
samples/sample_authentication.py |
Modernizes descriptions, env var docs (Azure AI Search, admin key), and adds index listing for service client auth scenarios. |
samples/sample_analyze_text.py |
Removes older analyze-text sample; functionality replaced by sample_index_analyze_text.py. |
samples/sample_agentic_retrieval.py |
New sample demonstrating creation and CRUD of knowledge sources/bases and a minimal semantic intent-based retrieval call. |
samples/files/hotel_small.json |
Removes older blob metadata JSON used by the previous indexer workflow sample. |
samples/data/synonym_map.txt |
New text file containing synonyms used by index synonym map CRUD samples. |
samples/data/query_vector.json |
New JSON file containing a precomputed query embedding vector for vector search samples. |
samples/async_samples/sample_vector_search_async.py |
Removes older async vector search sample that relied on live OpenAI embedding calls. |
samples/async_samples/sample_synonym_map_operations_async.py |
Removes older async synonym map sample; behavior moved into new async synonym map CRUD sample. |
samples/async_samples/sample_simple_query_async.py |
Removes older async simple query sample; replaced by sample_query_simple_async.py. |
samples/async_samples/sample_semantic_search_async.py |
Removes older async semantic search sample; superseded by sample_query_semantic_async.py. |
samples/async_samples/sample_search_client_send_request_async.py |
Removes older async custom-request sample with hardcoded API version. |
samples/async_samples/sample_search_client_custom_request_async.py |
New async SearchClient.send_request sample that imports AZURE_SEARCH_API_VERSION via sys.path adjustment and prints document count. |
samples/async_samples/sample_query_vector_async.py |
New async vector search sample mirroring sync sample_query_vector.py (index creation, document upload, query, cleanup). |
samples/async_samples/sample_query_suggestions_async.py |
Updates async suggestions sample to new naming, env docs, result text, and PascalCase field names. |
samples/async_samples/sample_query_simple_async.py |
New async simple query sample using updated field casing and result message. |
samples/async_samples/sample_query_session_async.py |
Updates async session query sample descriptions, env docs, and output to match sync variant and new schema. |
samples/async_samples/sample_query_semantic_async.py |
New async semantic search sample that configures semantic search and runs speller plus semantic ranking. |
samples/async_samples/sample_query_filter_async.py |
New async filtered + ordered query sample that mirrors sync sample_query_filter.py. |
samples/async_samples/sample_query_facets_async.py |
New async facet retrieval sample that mirrors sync sample_query_facets.py and awaits get_facets(). |
samples/async_samples/sample_query_autocomplete_async.py |
New async autocomplete sample matching the sync version’s behavior and naming. |
samples/async_samples/sample_indexers_operations_async.py |
Removes older async indexer operations sample; superseded by sample_indexer_crud_async.py and workflow samples. |
samples/async_samples/sample_indexer_datasource_crud_async.py |
New async data source CRUD sample parallel to sync version. |
samples/async_samples/sample_indexer_crud_async.py |
New async indexer CRUD sample paralleling sample_indexer_crud.py. |
samples/async_samples/sample_index_synonym_map_crud_async.py |
New async synonym map CRUD sample paralleling sync synonym map CRUD. |
samples/async_samples/sample_index_crud_operations_async.py |
Removes older async index CRUD sample; replaced by sample_index_crud_async.py. |
samples/async_samples/sample_index_crud_async.py |
New async index CRUD sample using PascalCase index field names and explicit index_name. |
samples/async_samples/sample_index_client_send_request_async.py |
Removes older async index client send-request sample. |
samples/async_samples/sample_index_client_custom_request_async.py |
New async SearchIndexClient.send_request sample using AZURE_SEARCH_API_VERSION via sample_utils. |
samples/async_samples/sample_index_analyze_text_async.py |
New async analyze-text sample mirroring sync sample_index_analyze_text.py. |
samples/async_samples/sample_index_alias_crud_operations_async.py |
Removes older async alias CRUD sample; replaced by sample_index_alias_crud_async.py. |
samples/async_samples/sample_index_alias_crud_async.py |
New async index alias CRUD sample mirroring sync alias sample with v2 index flow. |
samples/async_samples/sample_get_document_async.py |
Removes older async get-document sample; behavior integrated into sample_documents_crud_async.py. |
samples/async_samples/sample_filter_query_async.py |
Removes older async filter sample; superseded by sample_query_filter_async.py. |
samples/async_samples/sample_facet_query_async.py |
Removes older async facet sample; superseded by sample_query_facets_async.py. |
samples/async_samples/sample_documents_crud_async.py |
New async document CRUD sample mirroring sync sample_documents_crud.py. |
samples/async_samples/sample_documents_buffered_sender_async.py |
New async buffered sender sample mirroring sync sample_documents_buffered_sender.py. |
5c8f121 to
2423323
Compare
2423323 to
816022e
Compare
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines