Class MeiliSearch

Constructors

Properties

config: Config
httpRequest: HttpRequests
tasks: TaskClient

Methods

  • 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>

  • 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 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 one task on the client scope

    Parameters

    • taskUid: number

      Task identifier

    Returns Promise<Task>

    Promise returning a task

  • 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

    • Optionalconfig: Partial<Request>

      Additional request configuration options

    Returns Promise<MultiSearchResponse<T>>

    Promise containing the search responses

    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