Skip to main content 홈 크리에이터 beko2210 firstbrain azure-search-documents-ts
azure-search-documents-ts Build search applications with vector, hybrid, and semantic search capabilities.
설치로 이동 Skills Marketplace 커뮤니티가 만든 AI 스킬을 발견하고 탐색하세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/BEKO2210/Firstbrain --skill azure-search-documents-ts명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Zip 다운로드 다운로드 중... name azure-search-documents-ts description Build search applications with vector, hybrid, and semantic search capabilities. type skill created 2026-02-27T00:00:00.000Z domain cloud-infrastructure category azure risk unknown source community tags ["skill","cloud-infrastructure","azure","search","documents"]
Azure AI Search SDK for TypeScript
Build search applications with vector, hybrid, and semantic search capabilities.
Installation
npm install @azure/search-documents @azure/identity
Environment Variables
AZURE_SEARCH_ENDPOINT=https://<service-name>.search.windows.net
AZURE_SEARCH_INDEX_NAME=my-index
AZURE_SEARCH_ADMIN_KEY=<admin-key>
Authentication
import { SearchClient , SearchIndexClient } from "@azure/search-documents" ;
import { DefaultAzureCredential } from "@azure/identity" ;
const endpoint = process.env .AZURE_SEARCH_ENDPOINT !;
const indexName = process.env .AZURE_SEARCH_INDEX_NAME !;
const credential = new DefaultAzureCredential ();
const searchClient = new SearchClient (endpoint, indexName, credential);
const indexClient = new SearchIndexClient (endpoint, credential);
Core Workflow
Create Index with Vector Field
import { SearchIndex , SearchField , VectorSearch } from "@azure/search-documents" ;
const index : SearchIndex = {
name : ,
: [
{ : , : , : },
{ : , : , : },
{ : , : , : },
{ : , : , : , : },
{
: ,
: ,
: ,
: ,
: ,
},
],
: {
: [
{ : , : },
],
: [
{ : , : },
],
},
};
indexClient. (index);
"products"
fields
name
"id"
type
"Edm.String"
key
true
name
"title"
type
"Edm.String"
searchable
true
name
"description"
type
"Edm.String"
searchable
true
name
"category"
type
"Edm.String"
filterable
true
facetable
true
name
"embedding"
type
"Collection(Edm.Single)"
searchable
true
vectorSearchDimensions
1536
vectorSearchProfileName
"vector-profile"
vectorSearch
algorithms
name
"hnsw-algorithm"
kind
"hnsw"
profiles
name
"vector-profile"
algorithmConfigurationName
"hnsw-algorithm"
await
createOrUpdateIndex
Index Documents const documents = [
{ id : "1" , title : "Widget" , description : "A useful widget" , category : "Tools" , embedding : [...] },
{ id : "2" , title : "Gadget" , description : "A cool gadget" , category : "Electronics" , embedding : [...] },
];
const result = await searchClient.uploadDocuments (documents);
console .log (`Indexed ${result.results.length} documents` );
Full-Text Search const results = await searchClient.search ("widget" , {
select : ["id" , "title" , "description" ],
filter : "category eq 'Tools'" ,
orderBy : ["title asc" ],
top : 10 ,
});
for await (const result of results.results ) {
console .log (`${result.document .title} : ${result.score} ` );
}
Vector Search const queryVector = await getEmbedding ("useful tool" );
const results = await searchClient.search ("*" , {
vectorSearchOptions : {
queries : [
{
kind : "vector" ,
vector : queryVector,
fields : ["embedding" ],
kNearestNeighborsCount : 10 ,
},
],
},
select : ["id" , "title" , "description" ],
});
for await (const result of results.results ) {
console .log (`${result.document .title} : ${result.score} ` );
}
Hybrid Search (Text + Vector) const queryVector = await getEmbedding ("useful tool" );
const results = await searchClient.search ("tool" , {
vectorSearchOptions : {
queries : [
{
kind : "vector" ,
vector : queryVector,
fields : ["embedding" ],
kNearestNeighborsCount : 50 ,
},
],
},
select : ["id" , "title" , "description" ],
top : 10 ,
});
Semantic Search
const index : SearchIndex = {
name : "products" ,
fields : [...],
semanticSearch : {
configurations : [
{
name : "semantic-config" ,
prioritizedFields : {
titleField : { name : "title" },
contentFields : [{ name : "description" }],
},
},
],
},
};
const results = await searchClient.search ("best tool for the job" , {
queryType : "semantic" ,
semanticSearchOptions : {
configurationName : "semantic-config" ,
captions : { captionType : "extractive" },
answers : { answerType : "extractive" , count : 3 },
},
select : ["id" , "title" , "description" ],
});
for await (const result of results.results ) {
console .log (`${result.document .title} ` );
console .log (` Caption: ${result.captions?.[0 ]?.text} ` );
console .log (` Reranker Score: ${result.rerankerScore} ` );
}
Filtering and Facets
const results = await searchClient.search ("*" , {
filter : "category eq 'Electronics' and price lt 100" ,
facets : ["category,count:10" , "brand" ],
});
for (const [facetName, facetResults] of Object .entries (results.facets || {})) {
console .log (`${facetName} :` );
for (const facet of facetResults) {
console .log (` ${facet.value} : ${facet.count} ` );
}
}
Autocomplete and Suggestions
const index : SearchIndex = {
name : "products" ,
fields : [...],
suggesters : [
{ name : "sg" , sourceFields : ["title" , "description" ] },
],
};
const autocomplete = await searchClient.autocomplete ("wid" , "sg" , {
mode : "twoTerms" ,
top : 5 ,
});
const suggestions = await searchClient.suggest ("wid" , "sg" , {
select : ["title" ],
top : 5 ,
});
Batch Operations
const batch = [
{ upload : { id : "1" , title : "New Item" } },
{ merge : { id : "2" , title : "Updated Title" } },
{ delete : { id : "3" } },
];
const result = await searchClient.indexDocuments ({ actions : batch });
Key Types import {
SearchClient ,
SearchIndexClient ,
SearchIndexerClient ,
SearchIndex ,
SearchField ,
SearchOptions ,
VectorSearch ,
SemanticSearch ,
SearchIterator ,
} from "@azure/search-documents" ;
Best Practices
Use hybrid search - Combine vector + text for best results
Enable semantic ranking - Improves relevance for natural language queries
Batch document uploads - Use uploadDocuments with arrays, not single docs
Use filters for security - Implement document-level security with filters
Index incrementally - Use mergeOrUploadDocuments for updates
Monitor query performance - Use includeTotalCount: true sparingly in production
When to Use This skill is applicable to execute the workflow or actions described in the overview.
Connections
Domain: [[Cloud & Infrastruktur]]
Kategorie: [[Microsoft Azure]]
Navigation: [[Skills Uebersicht]], [[Home]]