Class MeiliSearch

Hierarchy

  • Client
    • MeiliSearch

Constructors

Properties

config: Config
httpRequest: HttpRequests
tasks: TaskClient
tokens: Token

Methods

  • Cancel a list of enqueued or processing tasks.

    Parameters

    • parameters: Omit<TasksQuery, "limit" | "from">

      Parameters to filter the tasks.

    Returns Promise<EnqueuedTask>

    Promise containing an EnqueuedTask

  • Delete an index

    Parameters

    • uid: string

      The index UID

    Returns Promise<EnqueuedTask>

    Promise which resolves when index is deleted successfully

  • Deletes an index if it already exists.

    Parameters

    • uid: string

      The index UID

    Returns Promise<boolean>

    Promise which resolves to true when index exists and is deleted successfully, otherwise false if it does not exist

  • Delete one API key

    Parameters

    • keyOrUid: string

      Key

    Returns Promise<void>

  • Delete a list of tasks.

    Parameters

    • parameters: Omit<TasksQuery, "limit" | "from"> = {}

      Parameters to filter the tasks.

    Returns Promise<EnqueuedTask>

    Promise containing an EnqueuedTask

  • Generate a tenant token

    Parameters

    • apiKeyUid: string

      The uid of the api key used as issuer of the token.

    • searchRules: TokenSearchRules

      Search rules that are applied to every search.

    • Optional options: TokenOptions

      Token options to customize some aspect of the token.

    Returns Promise<string>

    The token in JWT format.

  • Gather information about an index by calling MeiliSearch and return an Index instance with the gathered information

    Type Parameters

    • T extends Record<string, any> = Record<string, any>

    Parameters

    • indexUid: string

      The index UID

    Returns Promise<Index<T>>

    Promise returning Index instance

  • Get all the indexes as Index instances.

    Parameters

    • parameters: Pagination = {}

      Parameters to browse the indexes

    Returns Promise<IndexesResults<Index<Record<string, any>>[]>>

    Promise returning array of raw index information

  • Get one API key

    Parameters

    • keyOrUid: string

      Key or uid of the API key

    Returns Promise<Key>

    Promise returning a key

  • Gather information about an index by calling MeiliSearch and return the raw JSON response

    Parameters

    • indexUid: string

      The index UID

    Returns Promise<IndexObject>

    Promise returning index information

  • Get the stats of all the database

    Returns Promise<Stats>

    Promise returning object of all the stats

  • Get one task on the client scope

    Parameters

    • taskUid: number

      Task identifier

    Returns Promise<Task>

    Promise returning a task

  • Get the version of MeiliSearch

    Returns Promise<Version>

    Promise returning object with version details

  • Checks if the server is healthy, otherwise an error will be thrown.

    Returns Promise<Health>

    Promise returning an object with health details

  • Return an Index instance

    Type Parameters

    • T extends Record<string, any> = Record<string, any>

    Parameters

    • indexUid: string

      The index UID

    Returns Index<T>

    Instance of Index

  • Checks if the server is healthy, return true or false.

    Returns Promise<boolean>

    Promise returning a boolean

  • Perform multiple search queries.

    It is possible to make multiple search queries on the same index or on different ones

    Type Parameters

    • T extends Record<string, unknown> = Record<string, any>

    Parameters

    • queries: MultiSearchParams

      Search queries

    • Optional config: Partial<Request>

      Additional request configuration options

    Returns Promise<MultiSearchResponse<T>>

    Promise containing the search responses

    Example

    client.multiSearch({
    queries: [
    { indexUid: 'movies', q: 'wonder' },
    { indexUid: 'books', q: 'flower' },
    ],
    });
  • Type Parameters

    • T extends Record<string, unknown> = Record<string, any>

    Parameters

    Returns Promise<SearchResponse<T>>

  • Update one API key

    Parameters

    • keyOrUid: string

      Key

    • options: KeyUpdate

      Key options

    Returns Promise<Key>

    Promise returning a key

  • Wait for a task to be finished.

    Parameters

    • taskUid: number

      Task identifier

    • waitOptions: WaitOptions = {}

      Options on timeout and interval

    Returns Promise<Task>

    Promise returning an array of tasks

  • Wait for multiple tasks to be finished.

    Parameters

    • taskUids: number[]

      Tasks identifier

    • waitOptions: WaitOptions = {}

      Options on timeout and interval

    Returns Promise<Task[]>

    Promise returning an array of tasks