Azure AI Search — TypeScript SDK Quick Reference
Condensed from azure-search-documents-ts. Full patterns (semantic config, vector profiles, autocomplete) in the azure-search-documents-ts plugin skill if installed.
Install
npm install @azure/search-documents @azure/identityQuick Start
import { SearchClient, SearchIndexClient, SearchIndexerClient } from "@azure/search-documents";
const searchClient = new SearchClient(endpoint, indexName, credential);Non-Obvious Patterns
- Vector search uses
vectorSearchOptions.queriesarray withkind: "vector" - Semantic search requires
queryType: "semantic"+semanticSearchOptions - Batch ops:
searchClient.indexDocuments({ actions: [{ upload: doc }, { delete: doc }] })
Best Practices
- Use hybrid search — combine vector + text for best results
- Enable semantic ranking — improves relevance for natural language queries
- Batch document uploads — use
uploadDocumentswith arrays, not single docs - Use filters for security — implement document-level security with filters
- Index incrementally — use
mergeOrUploadDocumentsfor updates - Monitor query performance — use
includeTotalCount: truesparingly in production