Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Guidance for building and deploying AI solutions on Azure using Azure AI services and Copilot for Azure
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/sdk/azure-search-documents-dotnet.md
1# Azure AI Search — .NET SDK Quick Reference23> Condensed from **azure-search-documents-dotnet**. Full patterns (FieldBuilder, hybrid search, semantic answers)4> in the **azure-search-documents-dotnet** plugin skill if installed.56## Install7```bash8dotnet add package Azure.Search.Documents9```1011## Quick Start12```csharp13using Azure.Search.Documents;14using Azure.Search.Documents.Indexes;15var client = new SearchClient(new Uri(endpoint), indexName, credential);16```1718## Non-Obvious Patterns19- `FieldBuilder` + model attributes (`[SimpleField]`, `[SearchableField]`, `[VectorSearchField]`) for type-safe index definitions20- `VectorizedQuery` for vector search; set via `SearchOptions.VectorSearch.Queries`21- Semantic answers: `result.Value.SemanticSearch.Answers` / captions on each result2223## Best Practices241. Use `DefaultAzureCredential` for **local development only**. In production, use `ManagedIdentityCredential` — see [auth-best-practices.md](../auth-best-practices.md)252. Use `FieldBuilder` with model attributes for type-safe index definitions263. Use `CreateOrUpdateIndexAsync` for idempotent index creation274. Batch document operations for better throughput285. Use `Select` to return only needed fields296. Configure semantic search for natural language queries307. Combine vector + keyword + semantic for best relevance31