ReadonlyapiThe API version to use when communicating with the service.
ReadonlyendpointThe endpoint of the search service
ReadonlyindexThe name of the index
ReadonlyserviceThe service version to use when communicating with the service.
Based on a partial searchText from the user, return a list of potential completion strings based on a specified suggester.
import { SearchClient, AzureKeyCredential, SearchFieldArray } from "@azure/search-documents";
type TModel = {
key: string;
azure?: {
sdk: string | null;
} | null;
};
const client = new SearchClient<TModel>(
"endpoint.azure",
"indexName",
new AzureKeyCredential("key"),
);
const searchFields: SearchFieldArray<TModel> = ["azure/sdk"];
const autocompleteResult = await client.autocomplete("searchText", "suggesterName", {
searchFields,
});
Delete a set of documents.
Documents to be deleted.
Optionaloptions: IndexDocumentsOptionsAdditional options.
Delete a set of documents.
The name of their primary key in the index.
The primary key values of documents to delete.
Optionaloptions: IndexDocumentsOptionsAdditional options.
Retrieves the number of documents in the index.
Optional_options: OperationOptionsPerform a set of index modifications (upload, merge, mergeOrUpload, delete)
for the given set of documents.
This operation may partially succeed and not all document operations will
be reflected in the index. If you would like to treat this as an exception,
set the throwOnAnyFailure option to true.
For more details about how merging works, see: https://learn.microsoft.com/rest/api/searchservice/AddUpdate-or-Delete-Documents
Optional_options: IndexDocumentsOptionsUpdate a set of documents in the index.
For more details about how merging works, see https://learn.microsoft.com/rest/api/searchservice/AddUpdate-or-Delete-Documents
Optional_options: IndexDocumentsOptionsUpdate a set of documents in the index or upload them if they don't exist.
For more details about how merging works, see https://learn.microsoft.com/rest/api/searchservice/AddUpdate-or-Delete-Documents
Optional_options: IndexDocumentsOptionsPerforms a search on the current index given the specified arguments.
import { SearchClient, AzureKeyCredential, SearchFieldArray } from "@azure/search-documents";
type TModel = {
key: string;
azure?: {
sdk: string | null;
} | null;
};
const client = new SearchClient<TModel>(
"endpoint.azure",
"indexName",
new AzureKeyCredential("key"),
);
const select = ["azure/sdk"] as const;
const searchFields: SearchFieldArray<TModel> = ["azure/sdk"];
const searchResult = await client.search("searchText", {
select,
searchFields,
});
Returns a short list of suggestions based on the searchText and specified suggester.
import { SearchClient, AzureKeyCredential, SearchFieldArray } from "@azure/search-documents";
type TModel = {
key: string;
azure?: {
sdk: string | null;
} | null;
};
const client = new SearchClient<TModel>(
"endpoint.azure",
"indexName",
new AzureKeyCredential("key"),
);
const select = ["azure/sdk"] as const;
const searchFields: SearchFieldArray<TModel> = ["azure/sdk"];
const suggestResult = await client.suggest("searchText", "suggesterName", {
select,
searchFields,
});
An in-memory mock of the Azure SearchClient. It uses a Map to simulate the search index and applies the same OData filtering as the other mock clients.
Example