UNPKG

@azure/search-documents

Version:
141 lines 7.61 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import { createSearchIndex } from "./api/index.js"; import { getServiceStatistics, getKnowledgeSourceStatus, createKnowledgeSource, listKnowledgeSources, getKnowledgeSource, deleteKnowledgeSource, createOrUpdateKnowledgeSource, createKnowledgeBase, listKnowledgeBases, getKnowledgeBase, deleteKnowledgeBase, createOrUpdateKnowledgeBase, createAlias, listAliases, getAlias, deleteAlias, createOrUpdateAlias, analyzeText, getIndexStatistics, createIndex, listIndexesWithSelectedProperties, listIndexes, getIndex, deleteIndex, createOrUpdateIndex, createSynonymMap, getSynonymMaps, getSynonymMap, deleteSynonymMap, createOrUpdateSynonymMap, } from "./api/operations.js"; export class SearchIndexClient { _client; /** The pipeline used by this client to make requests */ pipeline; constructor(endpointParam, credential, options = {}) { const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-client` : `azsdk-js-client`; this._client = createSearchIndex(endpointParam, credential, { ...options, userAgentOptions: { userAgentPrefix }, }); this.pipeline = this._client.pipeline; } /** Gets service level statistics for a search service. */ getServiceStatistics(options = { requestOptions: {} }) { return getServiceStatistics(this._client, options); } /** Retrieves the status of a knowledge source. */ getKnowledgeSourceStatus(name, options = { requestOptions: {} }) { return getKnowledgeSourceStatus(this._client, name, options); } /** Creates a new knowledge source. */ createKnowledgeSource(knowledgeSource, options = { requestOptions: {} }) { return createKnowledgeSource(this._client, knowledgeSource, options); } /** Lists all knowledge sources available for a search service. */ listKnowledgeSources(options = { requestOptions: {} }) { return listKnowledgeSources(this._client, options); } /** Retrieves a knowledge source definition. */ getKnowledgeSource(name, options = { requestOptions: {} }) { return getKnowledgeSource(this._client, name, options); } /** Deletes an existing knowledge source. */ deleteKnowledgeSource(name, options = { requestOptions: {} }) { return deleteKnowledgeSource(this._client, name, options); } /** Creates a new knowledge source or updates an knowledge source if it already exists. */ createOrUpdateKnowledgeSource(knowledgeSource, name, options = { requestOptions: {} }) { return createOrUpdateKnowledgeSource(this._client, knowledgeSource, name, options); } /** Creates a new knowledge base. */ createKnowledgeBase(knowledgeBase, options = { requestOptions: {} }) { return createKnowledgeBase(this._client, knowledgeBase, options); } /** Lists all knowledge bases available for a search service. */ listKnowledgeBases(options = { requestOptions: {} }) { return listKnowledgeBases(this._client, options); } /** Retrieves a knowledge base definition. */ getKnowledgeBase(name, options = { requestOptions: {} }) { return getKnowledgeBase(this._client, name, options); } /** Deletes a knowledge base. */ deleteKnowledgeBase(name, options = { requestOptions: {} }) { return deleteKnowledgeBase(this._client, name, options); } /** Creates a new knowledge base or updates a knowledge base if it already exists. */ createOrUpdateKnowledgeBase(knowledgeBase, name, options = { requestOptions: {} }) { return createOrUpdateKnowledgeBase(this._client, knowledgeBase, name, options); } /** Creates a new search alias. */ createAlias(alias, options = { requestOptions: {} }) { return createAlias(this._client, alias, options); } /** Lists all aliases available for a search service. */ listAliases(options = { requestOptions: {} }) { return listAliases(this._client, options); } /** Retrieves an alias definition. */ getAlias(name, options = { requestOptions: {} }) { return getAlias(this._client, name, options); } /** Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery option. The mapped index is untouched by this operation. */ deleteAlias(name, options = { requestOptions: {} }) { return deleteAlias(this._client, name, options); } /** Creates a new search alias or updates an alias if it already exists. */ createOrUpdateAlias(alias, name, options = { requestOptions: {} }) { return createOrUpdateAlias(this._client, alias, name, options); } /** Shows how an analyzer breaks text into tokens. */ analyzeText(request, name, options = { requestOptions: {} }) { return analyzeText(this._client, request, name, options); } /** Returns statistics for the given index, including a document count and storage usage. */ getIndexStatistics(name, options = { requestOptions: {} }) { return getIndexStatistics(this._client, name, options); } /** Creates a new search index. */ createIndex(index, options = { requestOptions: {} }) { return createIndex(this._client, index, options); } /** Lists all indexes available for a search service. */ listIndexesWithSelectedProperties(options = { requestOptions: {} }) { return listIndexesWithSelectedProperties(this._client, options); } /** Lists all indexes available for a search service. */ listIndexes(options = { requestOptions: {} }) { return listIndexes(this._client, options); } /** Retrieves an index definition. */ getIndex(name, options = { requestOptions: {} }) { return getIndex(this._client, name, options); } /** Deletes a search index and all the documents it contains. This operation is permanent, with no recovery option. Make sure you have a master copy of your index definition, data ingestion code, and a backup of the primary data source in case you need to re-build the index. */ deleteIndex(name, options = { requestOptions: {} }) { return deleteIndex(this._client, name, options); } /** Creates a new search index or updates an index if it already exists. */ createOrUpdateIndex(index, name, options = { requestOptions: {} }) { return createOrUpdateIndex(this._client, index, name, options); } /** Creates a new synonym map. */ createSynonymMap(synonymMap, options = { requestOptions: {} }) { return createSynonymMap(this._client, synonymMap, options); } /** Lists all synonym maps available for a search service. */ getSynonymMaps(options = { requestOptions: {} }) { return getSynonymMaps(this._client, options); } /** Retrieves a synonym map definition. */ getSynonymMap(name, options = { requestOptions: {} }) { return getSynonymMap(this._client, name, options); } /** Deletes a synonym map. */ deleteSynonymMap(name, options = { requestOptions: {} }) { return deleteSynonymMap(this._client, name, options); } /** Creates a new synonym map or updates a synonym map if it already exists. */ createOrUpdateSynonymMap(synonymMap, name, options = { requestOptions: {} }) { return createOrUpdateSynonymMap(this._client, synonymMap, name, options); } } //# sourceMappingURL=searchIndexClient.js.map