Build Azure AI Search Applications
TypeScript skill for Azure AI Search - vector, hybrid, and semantic search with facets, suggesters, and batch operations.
Why it matters
Leverage Azure AI Search's powerful capabilities, including vector, hybrid, and semantic search, to build sophisticated search applications. This skill enables efficient indexing and querying of documents with advanced relevance features.
Outcomes
What it gets done
Create and manage Azure AI Search indexes with vector fields.
Index and update documents efficiently using batch operations.
Implement full-text, vector, and hybrid search queries.
Utilize semantic search for enhanced relevance and extract captions/answers.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-azure-search-documents-ts | bash Overview
Azure AI Search SDK for TypeScript
TypeScript skill for Azure AI Search, covering vector-enabled index definitions, batch document operations, and full-text, vector, semantic, and hybrid search query patterns with facets and autocomplete. Use when building full-text, vector, semantic, or hybrid search in a TypeScript/JavaScript application on Azure AI Search.
What it does
This skill builds search applications with vector, hybrid, and semantic search using @azure/search-documents (TypeScript) plus @azure/identity, authenticated via DefaultAzureCredential against a SearchClient (querying and document operations) and a SearchIndexClient (index management). Index creation defines fields with inline object literals (id as key, title/description as searchable text, category as filterable/facetable, and an embedding field typed Collection(Edm.Single) with a declared vector dimension count and profile name), paired with a vectorSearch configuration wiring an HNSW algorithm to a named profile. Documents are indexed via uploadDocuments with an array of typed objects including their embedding vectors. Full-text search (search(text, options)) supports field selection, OData filters, ordering, and paging; vector search passes a vectorSearchOptions.queries array with a kind: "vector" query (embedding, target fields, k-nearest-neighbors count) and a wildcard "*" text query; hybrid search combines a real text query with the same vector options in one call. Semantic search requires the index to declare a semanticSearch configuration (a name plus prioritized title/content fields), then queries with queryType: "semantic" and semanticSearchOptions (configuration name, extractive captions, and a capped number of extractive answers), reading back each result's caption text and rerankerScore. Filtering and faceting are shown together (an OData filter combined with faceted counts per field, accessed via results.facets), and autocomplete/suggestions require a suggesters array declared on the index (source fields to draw from) before calling autocomplete/suggest with a mode and result cap. Batch operations mix upload/merge/delete actions in a single indexDocuments({ actions }) call. Best practices: combine vector and text search for best relevance, enable semantic ranking for natural-language queries, always batch document uploads rather than calling one document at a time, use filters to implement document-level security, prefer mergeOrUploadDocuments for incremental updates, and use includeTotalCount: true sparingly in production since it adds query cost.
When to use - and when NOT to
Use this skill when building search functionality in a TypeScript/JavaScript application on Azure AI Search - full-text search with filters/facets, vector/embedding similarity search, natural-language semantic ranking, or a hybrid combination for best relevance. It is not an indexer/skillset orchestration guide (SearchIndexerClient is only named as a key type, not demonstrated) and does not cover AI enrichment pipelines or agentic retrieval - those are out of scope for this TypeScript reference.
Inputs and outputs
Input is documents (with precomputed embedding vectors) to index, and search queries (keyword text, vector embeddings, filters, or a combination). Output is ranked search results with scores, facet counts, autocomplete/suggestion candidates, and for semantic search, extractive captions with a reranker score.
Integrations
Built on Azure AI Search via @azure/search-documents, authenticated with Azure Identity's DefaultAzureCredential.
npm install @azure/search-documents @azure/identity
Who it's for
TypeScript/JavaScript developers building full-text, vector, semantic, or hybrid search experiences on Azure AI Search who need type-oriented index definitions and production query patterns, configured via AZURE_SEARCH_ENDPOINT, AZURE_SEARCH_INDEX_NAME, and, optionally, AZURE_SEARCH_ADMIN_KEY.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.