Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SearchIndexClient<T>

Package version

Class used to perform operations against a search index, including querying documents in the index as well as adding, updating, and removing them.

Type parameters

  • T

Hierarchy

Index

Constructors

constructor

  • new SearchIndexClient(credentials: coreHttp.TokenCredential | coreHttp.ServiceClientCredentials, apiVersion: string, endpoint: string, indexName: string, options?: coreHttp.ServiceClientOptions): SearchIndexClient
  • Initializes a new instance of the SearchIndexClient class.

    Example usage:

    const { SearchIndexClient, SearchApiKeyCredential } = require("@azure/search");
    
    const client = new SearchIndexClient(
      "<endpoint>",
      "<indexName>",
      new SearchApiKeyCredential("<Admin Key>");
    );

    Example usage:

    const { SearchIndexClient, SearchApiKeyCredential } = require("@azure/search");
    
    const client = new SearchIndexClient(
      "<endpoint>",
      "<indexName>",
      new SearchApiKeyCredential("<Admin Key>");
    );

    Parameters

    • credentials: coreHttp.TokenCredential | coreHttp.ServiceClientCredentials

      Subscription credentials which uniquely identify client subscription.

    • apiVersion: string

      Client Api Version.

    • endpoint: string

      The endpoint URL of the search service.

    • indexName: string

      The name of the index.

    • Optional options: coreHttp.ServiceClientOptions

    Returns SearchIndexClient

Properties

apiVersion

apiVersion: string = "2019-05-06"

The API version to use when communicating with the service.

credentials

credentials: coreHttp.TokenCredential | coreHttp.ServiceClientCredentials

documents

documents: Documents

endpoint

endpoint: string

The endpoint of the search service

indexName

indexName: string

The name of the index

Methods

autocomplete

  • Based on a partial searchText from the user, return a list of potential completion strings based on a specified suggester.

    Type parameters

    • Fields: keyof T

    Parameters

    Returns Promise<AutocompleteResult>

countDocuments

deleteDocuments

  • Delete a set of documents by their primary key.

    Parameters

    • keyName: keyof T

      The name of their primary key in the index.

    • keyValues: string[]

      The primary key values of documents to delete.

    • Default value options: DeleteDocumentsOptions = {}

      Additional options.

    Returns Promise<IndexDocumentsResult>

getDocument

  • Retrieve a particular document from the index by key.

    Type parameters

    • Fields: keyof T

    Parameters

    • key: string

      The primary key value of the document

    • Default value options: GetDocumentOptions<Fields> = {}

      Additional options

    Returns Promise<T>

indexDocuments

mergeDocuments

search

  • search<Fields>(options?: SearchOptions<Fields>): Promise<SearchDocumentsResult<Pick<T, Fields>>>
  • Performs a search on the current index given the specified arguments.

    Type parameters

    • Fields: keyof T

    Parameters

    • Default value options: SearchOptions<Fields> = {}

      Options for the search operation.

    Returns Promise<SearchDocumentsResult<Pick<T, Fields>>>

suggest

  • suggest<Fields>(options: SuggestOptions<Fields>): Promise<SuggestDocumentsResult<Pick<T, Fields>>>
  • Returns a short list of suggestions based on the searchText and specified suggester.

    Type parameters

    • Fields: keyof T

    Parameters

    Returns Promise<SuggestDocumentsResult<Pick<T, Fields>>>

uploadDocuments

Generated using TypeDoc