Class Index<T>

Type Parameters

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

Constructors

Properties

Methods

addDocuments addDocumentsFromString addDocumentsInBatches delete deleteAllDocuments deleteDocument deleteDocuments fetchInfo fetchPrimaryKey getDictionary getDisplayedAttributes getDistinctAttribute getDocument getDocuments getEmbedders getFaceting getFacetSearch getFilterableAttributes getLocalizedAttributes getNonSeparatorTokens getPagination getPrefixSearch getProximityPrecision getRankingRules getRawInfo getSearchableAttributes getSearchCutoffMs getSeparatorTokens getSettings getSortableAttributes getStats getStopWords getSynonyms getTask getTasks getTypoTolerance resetDictionary resetDisplayedAttributes resetDistinctAttribute resetEmbedders resetFaceting resetFacetSearch resetFilterableAttributes resetLocalizedAttributes resetNonSeparatorTokens resetPagination resetPrefixSearch resetProximityPrecision resetRankingRules resetSearchableAttributes resetSearchCutoffMs resetSeparatorTokens resetSettings resetSortableAttributes resetStopWords resetSynonyms resetTypoTolerance search searchForFacetValues searchGet searchSimilarDocuments update updateDictionary updateDisplayedAttributes updateDistinctAttribute updateDocuments updateDocumentsByFunction updateDocumentsFromString updateDocumentsInBatches updateEmbedders updateFaceting updateFacetSearch updateFilterableAttributes updateLocalizedAttributes updateNonSeparatorTokens updatePagination updatePrefixSearch updateProximityPrecision updateRankingRules updateSearchableAttributes updateSearchCutoffMs updateSeparatorTokens updateSettings updateSortableAttributes updateStopWords updateSynonyms updateTypoTolerance waitForTask waitForTasks create

Constructors

  • Type Parameters

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

    Parameters

    • config: Config

      Request configuration options

    • uid: string

      UID of the index

    • OptionalprimaryKey: string

      Primary Key of the index

    Returns Index<T>

Properties

createdAt: undefined | Date
httpRequest: HttpRequests
primaryKey: undefined | string
tasks: TaskClient
uid: string
updatedAt: undefined | Date

Methods

  • Add or replace multiples documents in a string format to an index. It only supports csv, ndjson and json formats.

    Parameters

    • documents: string

      Documents provided in a string to add/replace

    • contentType: ContentType

      Content type of your document: 'text/csv'|'application/x-ndjson'|'application/json'

    • OptionalqueryParams: RawDocumentAdditionOptions

    Returns Promise<EnqueuedTask>

    Promise containing an EnqueuedTask

  • Add or replace multiples documents to an index in batches

    Parameters

    • documents: T[]

      Array of Document objects to add/replace

    • batchSize: number = 1000

      Size of the batch

    • Optionaloptions: DocumentOptions

      Options on document addition

    Returns Promise<EnqueuedTask[]>

    Promise containing array of enqueued task objects for each batch

  • Delete one document

    Parameters

    • documentId: string | number

      Id of Document to delete

    Returns Promise<EnqueuedTask>

    Promise containing an EnqueuedTask

  • Fetch and update Index information.

    Returns Promise<Index<T>>

    Promise to the current Index object with updated information

  • Get Primary Key.

    Returns Promise<undefined | string>

    Promise containing the Primary Key of the index

  • Get the dictionary settings of a Meilisearch index.

    Returns Promise<string[]>

    Promise containing the dictionary settings

  • Get the displayed-attributes

    Returns Promise<string[]>

    Promise containing array of displayed-attributes

  • Get the distinct-attribute

    Returns Promise<null | string>

    Promise containing the distinct-attribute of the index

  • Get one document

    Type Parameters

    • D extends Record<string, any> = T

    Parameters

    • documentId: string | number

      Document ID

    • Optionalparameters: DocumentQuery<T>

      Parameters applied on a document

    Returns Promise<D>

    Promise containing Document response

  • Get documents of an index.

    Type Parameters

    • D extends Record<string, any> = T

    Parameters

    • parameters: DocumentsQuery<D> = {}

      Parameters to browse the documents. Parameters can contain the filter field only available in Meilisearch v1.2 and newer

    Returns Promise<ResourceResults<D[]>>

    Promise containing the returned documents

  • Get the facet search settings.

    Returns Promise<boolean>

    Promise containing object of facet search settings

  • Get the filterable-attributes

    Returns Promise<string[]>

    Promise containing an array of filterable-attributes

  • Get the list of all non-separator tokens.

    Returns Promise<string[]>

    Promise containing array of non-separator tokens

  • Get the list of all ranking-rules

    Returns Promise<string[]>

    Promise containing array of ranking-rules

  • Get the searchable-attributes

    Returns Promise<string[]>

    Promise containing array of searchable-attributes

  • Get the list of all separator tokens.

    Returns Promise<string[]>

    Promise containing array of separator tokens

  • Get the sortable-attributes

    Returns Promise<string[]>

    Promise containing array of sortable-attributes

  • Get the list of all stop-words

    Returns Promise<string[]>

    Promise containing array of stop-words

  • Get the list of all synonyms

    Returns Promise<object>

    Promise containing object of synonym mappings

  • Get one task of the index.

    Parameters

    • taskUid: number

      Task identifier

    Returns Promise<Task>

    Promise containing a task

  • Search for documents into an index

    Type Parameters

    Parameters

    • Optionalquery: null | string

      Query string

    • Optionaloptions: S

      Search options

    • Optionalconfig: Partial<Request>

      Additional request configuration options

    Returns Promise<SearchResponse<D, S>>

    Promise containing the search response

  • Search for documents into an index using the GET method

    Type Parameters

    Parameters

    • Optionalquery: null | string

      Query string

    • Optionaloptions: S

      Search options

    • Optionalconfig: Partial<Request>

      Additional request configuration options

    Returns Promise<SearchResponse<D, S>>

    Promise containing the search response

  • Add or update multiples documents to an index

    Parameters

    • documents: Partial<T>[]

      Array of Document objects to add/update

    • Optionaloptions: DocumentOptions

      Options on document update

    Returns Promise<EnqueuedTask>

    Promise containing an EnqueuedTask

  • Add or update multiples documents in a string format to an index. It only supports csv, ndjson and json formats.

    Parameters

    • documents: string

      Documents provided in a string to add/update

    • contentType: ContentType

      Content type of your document: 'text/csv'|'application/x-ndjson'|'application/json'

    • OptionalqueryParams: RawDocumentAdditionOptions

      Options on raw document addition

    Returns Promise<EnqueuedTask>

    Promise containing an EnqueuedTask

  • Add or update multiples documents to an index in batches

    Parameters

    • documents: Partial<T>[]

      Array of Document objects to add/update

    • batchSize: number = 1000

      Size of the batch

    • Optionaloptions: DocumentOptions

      Options on document update

    Returns Promise<EnqueuedTask[]>

    Promise containing array of enqueued task objects for each batch

  • Update the facet search settings.

    Parameters

    • facetSearch: boolean

      Boolean value

    Returns Promise<EnqueuedTask>

    Promise containing an EnqueuedTask

  • Update all settings Any parameters not provided will be left unchanged.

    Parameters

    • settings: Settings

      Object containing parameters with their updated values

    Returns Promise<EnqueuedTask>

    Promise containing an EnqueuedTask

  • Wait for a task to be processed.

    Parameters

    • taskUid: number

      Task identifier

    • waitOptions: WaitOptions = {}

      Options on timeout and interval

    Returns Promise<Task>

    Promise containing an array of tasks

  • Wait for multiple tasks to be processed.

    Parameters

    • taskUids: number[]

      Tasks identifier

    • waitOptions: WaitOptions = {}

      Options on timeout and interval

    Returns Promise<Task[]>

    Promise containing an array of tasks