Azure AI Search — .NET SDK Quick Reference
Condensed from azure-search-documents-dotnet. Full patterns (FieldBuilder, hybrid search, semantic answers) in the azure-search-documents-dotnet plugin skill if installed.
Install
dotnet add package Azure.Search.DocumentsQuick Start
using Azure.Search.Documents;
using Azure.Search.Documents.Indexes;
var client = new SearchClient(new Uri(endpoint), indexName, credential);Non-Obvious Patterns
FieldBuilder+ model attributes ([SimpleField],[SearchableField],[VectorSearchField]) for type-safe index definitionsVectorizedQueryfor vector search; set viaSearchOptions.VectorSearch.Queries- Semantic answers:
result.Value.SemanticSearch.Answers/ captions on each result
Best Practices
- Use
DefaultAzureCredentialfor local development only. In production, useManagedIdentityCredential— see auth-best-practices.md - Use
FieldBuilderwith model attributes for type-safe index definitions - Use
CreateOrUpdateIndexAsyncfor idempotent index creation - Batch document operations for better throughput
- Use
Selectto return only needed fields - Configure semantic search for natural language queries
- Combine vector + keyword + semantic for best relevance