meilisearch package

Subpackages

Submodules

meilisearch.client module

class meilisearch.client.Client(url: str, api_key: str | None = None, timeout: int | None = None, client_agents: Tuple[str, ...] | None = None)[source]

Bases: object

A client for the Meilisearch API

A client instance is needed for every Meilisearch API method to know the location of Meilisearch and its permissions.

cancel_tasks(parameters: MutableMapping[str, Any]) TaskInfo[source]

Cancel a list of enqueued or processing tasks.

Parameters:

parameters – parameters accepted by the cancel tasks route:https://www.meilisearch.com/docs/reference/api/tasks#cancel-tasks.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

create_dump() TaskInfo[source]

Trigger the creation of a Meilisearch dump.

Returns:

Information about the dump. https://www.meilisearch.com/docs/reference/api/dump#create-a-dump

Return type:

Dump

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

create_index(uid: str, options: Mapping[str, Any] | None = None) TaskInfo[source]

Create an index.

Parameters:
  • uid (str) – UID of the index.

  • (optional) (options) – Options passed during index creation (ex: primaryKey).

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

create_key(options: Mapping[str, Any]) Key[source]

Creates a new API key.

Parameters:

options – Options, the information to use in creating the key (ex: { ‘actions’: [‘*’], ‘indexes’: [‘movies’], ‘description’: ‘Search Key’, ‘expiresAt’: ‘22-01-01’ }). An actions, an indexes and a expiresAt fields are mandatory,`None` should be specified for no expiration date. actions: A list of actions permitted for the key. [“*”] for all actions. indexes: A list of indexes permitted for the key. [“*”] for all indexes. Note that if an expires_at value is included it should be in UTC time.

Returns:

The new API key. https://www.meilisearch.com/docs/reference/api/keys#get-keys

Return type:

key

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

create_snapshot() TaskInfo[source]

Trigger the creation of a Meilisearch snapshot.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

delete_index(uid: str) TaskInfo[source]

Deletes an index

Parameters:

uid – UID of the index.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

delete_key(key_or_uid: str) int[source]

Deletes an API key.

Parameters:

key – The key or the uid of the key to delete.

Returns:

The Response status code. 204 signifies a successful delete. https://www.meilisearch.com/docs/reference/api/keys#get-keys

Return type:

keys

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

delete_tasks(parameters: MutableMapping[str, Any]) TaskInfo[source]

Delete a list of finished tasks.

Parameters:

(optional) (parameters) – parameters accepted by the delete tasks route:https://www.meilisearch.com/docs/reference/api/tasks#delete-task.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

generate_tenant_token(api_key_uid: str, search_rules: Mapping[str, Any] | Sequence[str], *, expires_at: datetime | None = None, api_key: str | None = None) str[source]

Generate a JWT token for the use of multitenancy.

Parameters:
  • api_key_uid – The uid of the API key used as issuer of the token.

  • search_rules – A Dictionary or list of string which contains the rules to be enforced at search time for all or specific accessible indexes for the signing API Key. In the specific case where you do not want to have any restrictions you can also use a list [“*”].

  • (optional) (api_key) – Date and time when the key will expire. Note that if an expires_at value is included it should be in UTC time.

  • (optional) – The API key parent of the token. If you leave it empty the client API Key will be used.

Returns:

A string containing the jwt tenant token. Note: If your token does not work remember that the search_rules is mandatory and should be well formatted. exp must be a datetime in the future. It’s not possible to create a token from the master key.

Return type:

jwt_token

get_all_stats() Dict[str, Any][source]

Get all stats of Meilisearch

Get information about database size and all indexes https://www.meilisearch.com/docs/reference/api/stats

Returns:

Dictionary containing stats about your Meilisearch instance.

Return type:

stats

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_index(uid: str) Index[source]

Get the index. This index should already exist.

Parameters:

uid – UID of the index.

Returns:

An Index instance containing the information of the fetched index.

Return type:

index

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_indexes(parameters: Mapping[str, Any] | None = None) Dict[str, List[Index]][source]

Get all indexes.

Parameters:

(optional) (parameters) – parameters accepted by the get indexes route: https://www.meilisearch.com/docs/reference/api/indexes#list-all-indexes

Returns:

Dictionary with limit, offset, total and results a list of Index instances.

Return type:

indexes

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_key(key_or_uid: str) Key[source]

Gets information about a specific API key.

Parameters:

key_or_uid – The key or the uid for which to retrieve the information.

Returns:

The API key. https://www.meilisearch.com/docs/reference/api/keys#get-key

Return type:

key

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_keys(parameters: Mapping[str, Any] | None = None) KeysResults[source]

Gets the Meilisearch API keys.

Parameters:

(optional) (parameters) – parameters accepted by the get keys route: https://www.meilisearch.com/docs/reference/api/keys#get-all-keys

Returns:

API keys. https://www.meilisearch.com/docs/reference/api/keys#get-keys

Return type:

keys

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_raw_index(uid: str) Dict[str, Any][source]

Get the index as a dictionary. This index should already exist.

Parameters:

uid – UID of the index.

Returns:

An index in dictionary format. (e.g { ‘uid’: ‘movies’ ‘primaryKey’: ‘objectID’ })

Return type:

index

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_raw_indexes(parameters: Mapping[str, Any] | None = None) List[Dict[str, Any]][source]

Get all indexes in dictionary format.

Parameters:

(optional) (parameters) – parameters accepted by the get indexes route: https://www.meilisearch.com/docs/reference/api/indexes#list-all-indexes

Returns:

Dictionary with limit, offset, total and results a list of indexes in dictionary format. (e.g [{ ‘uid’: ‘movies’ ‘primaryKey’: ‘objectID’ }])

Return type:

indexes

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_task(uid: int) Task[source]

Get one task.

Parameters:

uid – Identifier of the task.

Returns:

Task instance containing information about the processed asynchronous task.

Return type:

task

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_tasks(parameters: MutableMapping[str, Any] | None = None) TaskResults[source]

Get all tasks.

Parameters:

(optional) (parameters) – parameters accepted by the get tasks route: https://www.meilisearch.com/docs/reference/api/tasks#get-tasks.

Returns:

TaskResult instance containing limit, from, next and results containing a list of all enqueued, processing, succeeded or failed tasks.

Return type:

task

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_version() Dict[str, str][source]

Get version Meilisearch

Returns:

Information about the version of Meilisearch.

Return type:

version

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

health() Dict[str, str][source]

Get health of the Meilisearch server.

Returns:

Dictionary containing the status of the Meilisearch instance.

Return type:

health

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

index(uid: str) Index[source]

Create a local reference to an index identified by UID, without doing an HTTP call. Calling this method doesn’t create an index in the Meilisearch instance, but grants access to all the other methods in the Index class.

Parameters:

uid – UID of the index.

Returns:

An Index instance.

Return type:

index

is_healthy() bool[source]

Get health of the Meilisearch server.

Multi-index search.

Parameters:
Returns:

Dictionary of results for each search query

Return type:

results

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

swap_indexes(parameters: List[Mapping[str, List[str]]]) TaskInfo[source]

Swap two indexes.

Parameters:

indexes – List of indexes to swap (ex: [{“indexes”: [“indexA”, “indexB”]}).

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_key(key_or_uid: str, options: Mapping[str, Any]) Key[source]

Update an API key.

Parameters:
  • key_or_uid – The key or the uid of the key for which to update the information.

  • options – The information to use in creating the key (ex: { ‘description’: ‘Search Key’, ‘expiresAt’: ‘22-01-01’ }). Note that if an expires_at value is included it should be in UTC time.

Returns:

The updated API key. https://www.meilisearch.com/docs/reference/api/keys#get-keys

Return type:

key

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

version() Dict[str, str][source]

Alias for get_version

Returns:

Information about the version of Meilisearch.

Return type:

version

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

wait_for_task(uid: int, timeout_in_ms: int = 5000, interval_in_ms: int = 50) Task[source]

Wait until Meilisearch processes a task until it fails or succeeds.

Parameters:
  • uid – Identifier of the task to wait for being processed.

  • (optional) (interval_in_ms) – Time the method should wait before raising a MeilisearchTimeoutError

  • (optional) – Time interval the method should wait (sleep) between requests

Returns:

Task instance containing information about the processed asynchronous task.

Return type:

task

Raises:

MeilisearchTimeoutError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

meilisearch.config module

class meilisearch.config.Config(url: str, api_key: str | None = None, timeout: int | None = None, client_agents: Tuple[str, ...] | None = None)[source]

Bases: object

Client’s credentials and configuration parameters

class Paths[source]

Bases: object

accept_new_fields = 'accept-new-fields'
dictionary = 'dictionary'
displayed_attributes = 'displayed-attributes'
distinct_attribute = 'distinct-attribute'
document = 'documents'
dumps = 'dumps'
embedders = 'embedders'
faceting = 'faceting'
filterable_attributes = 'filterable-attributes'
health = 'health'
index = 'indexes'
keys = 'keys'
non_separator_tokens = 'non-separator-tokens'
pagination = 'pagination'
proximity_precision = 'proximity-precision'
ranking_rules = 'ranking-rules'
search = 'search'
search_cutoff_ms = 'search-cutoff-ms'
searchable_attributes = 'searchable-attributes'
separator_tokens = 'separator-tokens'
setting = 'settings'
snapshots = 'snapshots'
sortable_attributes = 'sortable-attributes'
stat = 'stats'
stop_words = 'stop-words'
swap = 'swap-indexes'
synonyms = 'synonyms'
task = 'tasks'
typo_tolerance = 'typo-tolerance'
version = 'version'

meilisearch.errors module

exception meilisearch.errors.MeilisearchApiError(error: str, request: Response)[source]

Bases: MeilisearchError

Error sent by Meilisearch API

exception meilisearch.errors.MeilisearchCommunicationError(message: str)[source]

Bases: MeilisearchError

Error when connecting to Meilisearch

exception meilisearch.errors.MeilisearchError(message: str)[source]

Bases: Exception

Generic class for Meilisearch error handling

exception meilisearch.errors.MeilisearchTimeoutError(message: str)[source]

Bases: MeilisearchError

Error when Meilisearch operation takes longer than expected

meilisearch.errors.version_error_hint_message(func: Callable[[...], T]) Callable[[...], T][source]

meilisearch.index module

class meilisearch.index.Index(config: Config, uid: str, primary_key: str | None = None, created_at: datetime | str | None = None, updated_at: datetime | str | None = None)[source]

Bases: object

Indexes routes wrapper.

Index class gives access to all indexes routes and child routes (inherited). https://www.meilisearch.com/docs/reference/api/indexes

add_documents(documents: Sequence[Mapping[str, Any]], primary_key: str | None = None, *, serializer: Type[JSONEncoder] | None = None) TaskInfo[source]

Add documents to the index.

Parameters:
  • documents – List of documents. Each document should be a dictionary.

  • (optional) (serializer) – The primary-key used in index. Ignored if already set up.

  • (optional) – A custom JSONEncode to handle serializing fields that the build in json.dumps cannot handle, for example UUID and datetime.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

add_documents_csv(str_documents: str, primary_key: str | None = None, csv_delimiter: str | None = None) TaskInfo[source]

Add string documents from a CSV file to the index.

Parameters:
  • str_documents – String of document from a CSV file.

  • (optional) (primary_key) – The primary-key used in index. Ignored if already set up.

  • csv_delimiter – One ASCII character used to customize the delimiter for CSV. Comma used by default.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

add_documents_in_batches(documents: Sequence[Mapping[str, Any]], batch_size: int = 1000, primary_key: str | None = None, *, serializer: Type[JSONEncoder] | None = None) List[TaskInfo][source]

Add documents to the index in batches.

Parameters:
  • documents – List of documents. Each document should be a dictionary.

  • (optional) (serializer) – The number of documents that should be included in each batch. Default = 1000

  • (optional) – The primary-key used in index. Ignored if already set up.

  • (optional) – A custom JSONEncode to handle serializing fields that the build in json.dumps cannot handle, for example UUID and datetime.

Returns:

List of TaskInfo instances containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

tasks_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

add_documents_json(str_documents: str, primary_key: str | None = None, *, serializer: Type[JSONEncoder] | None = None) TaskInfo[source]

Add string documents from JSON file to the index.

Parameters:
  • str_documents – String of document from a JSON file.

  • (optional) (serializer) – The primary-key used in index. Ignored if already set up.

  • (optional) – A custom JSONEncode to handle serializing fields that the build in json.dumps cannot handle, for example UUID and datetime.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

add_documents_ndjson(str_documents: str, primary_key: str | None = None) TaskInfo[source]

Add string documents from a NDJSON file to the index.

Parameters:
  • str_documents – String of document from a NDJSON file.

  • (optional) (primary_key) – The primary-key used in index. Ignored if already set up.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

add_documents_raw(str_documents: str, primary_key: str | None = None, content_type: str | None = None, csv_delimiter: str | None = None, *, serializer: Type[JSONEncoder] | None = None) TaskInfo[source]

Add string documents to the index.

Parameters:
  • str_documents – String of document.

  • (optional) (serializer) – The primary-key used in index. Ignored if already set up.

  • type – The type of document. Type available: ‘csv’, ‘json’, ‘jsonl’.

  • csv_delimiter – One ASCII character used to customize the delimiter for CSV. Note: The csv delimiter can only be used with the Content-Type text/csv.

  • (optional) – A custom JSONEncode to handle serializing fields that the build in json.dumps cannot handle, for example UUID and datetime.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

static create(config: Config, uid: str, options: Mapping[str, Any] | None = None) TaskInfo[source]

Create the index.

Parameters:
  • uid – UID of the index.

  • options – Options passed during index creation (ex: { ‘primaryKey’: ‘name’ }).

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

delete() TaskInfo[source]

Delete the index.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

delete_all_documents() TaskInfo[source]

Delete all documents from the index.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

delete_document(document_id: str | int) TaskInfo[source]

Delete one document from the index.

Parameters:

document_id – Unique identifier of the document.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

delete_documents(ids: List[str | int] | None = None, *, filter: str | List[str | List[str]] | None = None) TaskInfo[source]

Delete multiple documents from the index by id or filter.

Parameters:
  • ids – List of unique identifiers of documents. Note: using ids is depreciated and will be removed in a future version.

  • filter – The filter value information.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

Perform a facet search based on the given facet query and facet name.

Parameters:
  • facet_name – String containing the name of the facet on which the search is performed.

  • (optional) (opt_params) – String containing the searched words

  • (optional) – Dictionary containing optional query parameters.

Returns:

Dictionary with facetHits, processingTime and initial facet query

Return type:

results

fetch_info() Index[source]

Fetch the info of the index.

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_dictionary() List[str][source]

Get the dictionary entries of the index.

Returns:

List containing the dictionary entries of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_displayed_attributes() List[str][source]

Get displayed attributes of the index.

Returns:

List containing the displayed attributes of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_distinct_attribute() str | None[source]

Get distinct attribute of the index.

Returns:

String containing the distinct attribute of the index. If no distinct attribute None is returned.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_document(document_id: str | int, parameters: MutableMapping[str, Any] | None = None) Document[source]

Get one document with given document identifier.

Parameters:
Returns:

Document instance containing the documents information.

Return type:

document

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_documents(parameters: MutableMapping[str, Any] | None = None) DocumentsResults[source]

Get a set of documents from the index.

Parameters:

(optional) (parameters) – parameters accepted by the get documents route: https://www.meilisearch.com/docs/reference/api/documents#get-documents Note: The filter parameter is only available in Meilisearch >= 1.2.0.

Returns:

  • documents

  • DocumentsResults instance with attributes

    • total

    • offset

    • limit

    • results : list of Document instances containing the documents information

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_embedders() Embedders | None[source]

Get embedders of the index.

Returns:

The embedders settings of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_faceting_settings() Faceting[source]

Get the faceting settings of an index.

Returns:

The faceting settings of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_filterable_attributes() List[str][source]

Get filterable attributes of the index.

Returns:

List containing the filterable attributes of the index

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_non_separator_tokens() List[str][source]

Get the list of disabled text separator tokens on this index.

Returns:

List containing the disabled separator tokens of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_pagination_settings() Pagination[source]

Get pagination settngs of the index.

Returns:

The pagination settings of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_primary_key() str | None[source]

Get the primary key.

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_proximity_precision() ProximityPrecision[source]

Get the proximity_precision of the index.

Returns:

proximity_precision of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_ranking_rules() List[str][source]

Get ranking rules of the index.

Returns:

settings – List containing the ranking rules of the index.

Return type:

list

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_search_cutoff_ms() int | None[source]

Get the search cutoff in ms of the index.

Returns:

Integer value of search cutoff in ms of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_searchable_attributes() List[str][source]

Get searchable attributes of the index.

Returns:

List containing the searchable attributes of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_separator_tokens() List[str][source]

Get the additional text separator tokens set on this index.

Returns:

List containing the separator tokens of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_settings() Dict[str, Any][source]

Get settings of the index.

https://www.meilisearch.com/docs/reference/api/settings

Returns:

Dictionary containing the settings of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_sortable_attributes() List[str][source]

Get sortable attributes of the index.

Returns:

List containing the sortable attributes of the index

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_stats() IndexStats[source]

Get stats of the index.

Get information about the number of documents, field frequencies, … https://www.meilisearch.com/docs/reference/api/stats

Returns:

IndexStats instance containing information about the given index.

Return type:

stats

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_stop_words() List[str][source]

Get stop words of the index.

Returns:

List containing the stop words of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_synonyms() Dict[str, List[str]][source]

Get synonyms of the index.

Returns:

settings – Dictionary containing the synonyms of the index.

Return type:

dict

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_task(uid: int) Task[source]

Get one task through the route of a specific index.

Parameters:

uid – identifier of the task.

Returns:

Task instance containing information about the processed asynchronous task of an index.

Return type:

task

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_tasks(parameters: MutableMapping[str, Any] | None = None) TaskResults[source]

Get all tasks of a specific index from the last one.

Parameters:

(optional) (parameters) – parameters accepted by the get tasks route: https://www.meilisearch.com/docs/reference/api/tasks#get-tasks.

Returns:

  • tasks

  • TaskResults instance with attributes

    • from

    • next

    • limit

    • results : list of Task instances containing all enqueued, processing, succeeded or failed tasks of the index

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_typo_tolerance() TypoTolerance[source]

Get typo tolerance of the index.

Returns:

The typo tolerance settings of the index.

Return type:

settings

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_dictionary() TaskInfo[source]

Clear all entries in dictionary

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_displayed_attributes() TaskInfo[source]

Reset displayed attributes of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_distinct_attribute() TaskInfo[source]

Reset distinct attribute of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_embedders() TaskInfo[source]

Reset embedders of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_faceting_settings() TaskInfo[source]

Reset faceting settings of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_filterable_attributes() TaskInfo[source]

Reset filterable attributes of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_non_separator_tokens() TaskInfo[source]

Clear all disabled separator tokens

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_pagination_settings() TaskInfo[source]

Reset pagination settings of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_proximity_precision() TaskInfo[source]

Reset the proximity_precision of the index

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_ranking_rules() TaskInfo[source]

Reset ranking rules of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_search_cutoff_ms() TaskInfo[source]

Reset the search cutoff of the index

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_searchable_attributes() TaskInfo[source]

Reset searchable attributes of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_separator_tokens() TaskInfo[source]

Clear all additional separator tokens

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_settings() TaskInfo[source]

Reset settings of the index to default values.

https://www.meilisearch.com/docs/reference/api/settings#reset-settings

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_sortable_attributes() TaskInfo[source]

Reset sortable attributes of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_stop_words() TaskInfo[source]

Reset stop words of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_synonyms() TaskInfo[source]

Reset synonyms of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

reset_typo_tolerance() TaskInfo[source]

Reset typo tolerance of the index to default values.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

search(query: str, opt_params: Mapping[str, Any] | None = None) Dict[str, Any][source]

Search in the index.

Parameters:
  • query – String containing the searched word(s)

  • (optional) (opt_params) – Dictionary containing optional query parameters. Note: The vector parameter is only available in Meilisearch >= v1.3.0, and is experimental Meilisearch v1.3.0. In order to use this feature in Meilisearch v1.3.0 you first need to enable the feature by sending a PATCH request to /experimental-features with { “vectoreStore”: true }. Because this feature is experimental it may be removed or updated causing breaking changes in this library without a major version bump so use with caution. https://www.meilisearch.com/docs/reference/api/search#search-in-an-index

Returns:

Dictionary with hits, offset, limit, processingTime and initial query

Return type:

results

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update(primary_key: str) TaskInfo[source]

Update the index primary-key.

Parameters:

primary_key – The primary key to use for the index.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_dictionary(body: List[str] | None) TaskInfo[source]

Update the dictionary of the index.

Parameters:

body – List of the new dictionary entries.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_displayed_attributes(body: List[str] | None) TaskInfo[source]

Update displayed attributes of the index.

Parameters:

body – List containing the displayed attributes.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_distinct_attribute(body: str) TaskInfo[source]

Update distinct attribute of the index.

Parameters:

body – String containing the distinct attribute.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_documents(documents: Sequence[Mapping[str, Any]], primary_key: str | None = None, *, serializer: Type[JSONEncoder] | None = None) TaskInfo[source]

Update documents in the index.

Parameters:
  • documents – List of documents. Each document should be a dictionary.

  • (optional) (serializer) – The primary-key used in index. Ignored if already set up

  • (optional) – A custom JSONEncode to handle serializing fields that the build in json.dumps cannot handle, for example UUID and datetime.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_documents_csv(str_documents: str, primary_key: str | None = None, csv_delimiter: str | None = None) TaskInfo[source]

Update documents as a csv string in the index.

Parameters:
  • str_documents – String of document from a CSV file.

  • (optional) (primary_key) – The primary-key used in index. Ignored if already set up.

  • csv_delimiter – One ASCII character used to customize the delimiter for CSV. Comma used by default.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_documents_in_batches(documents: Sequence[Mapping[str, Any]], batch_size: int = 1000, primary_key: str | None = None, serializer: Type[JSONEncoder] | None = None) List[TaskInfo][source]

Update documents to the index in batches.

Parameters:
  • documents – List of documents. Each document should be a dictionary.

  • (optional) (serializer) – The number of documents that should be included in each batch. Default = 1000

  • (optional) – The primary-key used in index. Ignored if already set up.

  • (optional) – A custom JSONEncode to handle serializing fields that the build in json.dumps cannot handle, for example UUID and datetime.

Returns:

List of TaskInfo instances containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

tasks_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_documents_json(str_documents: str, primary_key: str | None = None, *, serializer: Type[JSONEncoder] | None = None) TaskInfo[source]

Update documents as a json string in the index.

Parameters:
  • str_documents – String of document from a JSON file.

  • (optional) (serializer) – The primary-key used in index. Ignored if already set up

  • (optional) – A custom JSONEncode to handle serializing fields that the build in json.dumps cannot handle, for example UUID and datetime.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_documents_ndjson(str_documents: str, primary_key: str | None = None) TaskInfo[source]

Update documents as a ndjson string in the index.

Parameters:
  • str_documents – String of document from a NDJSON file.

  • (optional) (primary_key) – The primary-key used in index. Ignored if already set up

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_documents_raw(str_documents: str, primary_key: str | None = None, content_type: str | None = None, csv_delimiter: str | None = None, *, serializer: Type[JSONEncoder] | None = None) TaskInfo[source]

Update documents as a string in the index.

Parameters:
  • str_documents – String of document.

  • (optional) (serializer) – The primary-key used in index. Ignored if already set up.

  • type – The type of document. Type available: ‘csv’, ‘json’, ‘jsonl’

  • csv_delimiter – One ASCII character used to customize the delimiter for CSV. Note: The csv delimiter can only be used with the Content-Type text/csv.

  • (optional) – A custom JSONEncode to handle serializing fields that the build in json.dumps cannot handle, for example UUID and datetime.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_embedders(body: MutableMapping[str, Any] | None) TaskInfo[source]

Update embedders of the index.

Parameters:

body (dict) – Dictionary containing the embedders.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_faceting_settings(body: Mapping[str, Any] | None) TaskInfo[source]

Update the faceting settings of the index.

Parameters:

body (dict) – Dictionary containing the faceting settings. https://www.meilisearch.com/docs/reference/api/settings#update-pagination-settings

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_filterable_attributes(body: List[str] | None) TaskInfo[source]

Update filterable attributes of the index.

Parameters:

body – List containing the filterable attributes.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_non_separator_tokens(body: List[str] | None) TaskInfo[source]

Update the disabled separator tokens of the index.

Parameters:

body – List of the newly disabled separator tokens.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_pagination_settings(body: Dict[str, Any] | None) TaskInfo[source]

Update the pagination settings of the index.

Parameters:

body (dict) – Dictionary containing the pagination settings. https://www.meilisearch.com/docs/reference/api/settings#update-pagination-settings

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_proximity_precision(body: ProximityPrecision | None) TaskInfo[source]

Update the proximity_precision of the index.

Parameters:

body – proximity_precision

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_ranking_rules(body: List[str] | None) TaskInfo[source]

Update ranking rules of the index.

Parameters:

body – List containing the ranking rules.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_search_cutoff_ms(body: int | None) TaskInfo[source]

Update the search cutoff in ms of the index.

Parameters:

body – Integer value of the search cutoff time in ms.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_searchable_attributes(body: List[str] | None) TaskInfo[source]

Update searchable attributes of the index.

Parameters:

body – List containing the searchable attributes.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_separator_tokens(body: List[str] | None) TaskInfo[source]

Update the additional separator tokens of the index.

Parameters:

body – List of the new separator tokens.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_settings(body: MutableMapping[str, Any]) TaskInfo[source]

Update settings of the index.

https://www.meilisearch.com/docs/reference/api/settings#update-settings

Parameters:

body – Dictionary containing the settings of the index. More information: https://www.meilisearch.com/docs/reference/api/settings#update-settings

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_sortable_attributes(body: List[str] | None) TaskInfo[source]

Update sortable attributes of the index.

Parameters:

body – List containing the sortable attributes.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_stop_words(body: List[str] | None) TaskInfo[source]

Update stop words of the index.

Parameters:

body (list) – List containing the stop words.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_synonyms(body: Dict[str, List[str]] | None) TaskInfo[source]

Update synonyms of the index.

Parameters:

body (dict) – Dictionary containing the synonyms.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

update_typo_tolerance(body: Mapping[str, Any] | None) TaskInfo[source]

Update typo tolerance of the index.

Parameters:

body (dict) – Dictionary containing the typo tolerance.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

wait_for_task(uid: int, timeout_in_ms: int = 5000, interval_in_ms: int = 50) Task[source]

Wait until Meilisearch processes a task until it fails or succeeds.

Parameters:
  • uid – identifier of the task to wait for being processed.

  • (optional) (interval_in_ms) – time the method should wait before raising a MeilisearchTimeoutError.

  • (optional) – time interval the method should wait (sleep) between requests.

Returns:

Task instance containing information about the processed asynchronous task.

Return type:

task

Raises:

MeilisearchTimeoutError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

meilisearch.task module

class meilisearch.task.TaskHandler(config: Config)[source]

Bases: object

A class covering the Meilisearch Task API

The task class gives access to all task routes and gives information about the progress of asynchronous operations. https://www.meilisearch.com/docs/reference/api/tasks

cancel_tasks(parameters: MutableMapping[str, Any]) TaskInfo[source]

Cancel a list of enqueued or processing tasks.

Parameters:

parameters – parameters accepted by the cancel tasks https://www.meilisearch.com/docs/reference/api/tasks#cancel-task.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

delete_tasks(parameters: MutableMapping[str, Any]) TaskInfo[source]

Delete a list of enqueued or processing tasks. :param config: Config object containing permission and location of Meilisearch. :param parameters: parameters accepted by the delete tasks route:https://www.meilisearch.com/docs/reference/api/tasks#delete-task.

Returns:

TaskInfo instance containing information about a task to track the progress of an asynchronous process. https://www.meilisearch.com/docs/reference/api/tasks#get-one-task

Return type:

task_info

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_task(uid: int) Task[source]

Get one task.

Parameters:

uid – Identifier of the task.

Returns:

Task instance containing information about the processed asynchronous task.

Return type:

task

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

get_tasks(parameters: MutableMapping[str, Any] | None = None) TaskResults[source]

Get all tasks.

Parameters:

(optional) (parameters) – parameters accepted by the get tasks route: https://www.meilisearch.com/docs/reference/api/tasks#get-tasks.

Returns:

TaskResults instance contining limit, from, next and results containing a list of all enqueued, processing, succeeded or failed tasks.

Return type:

task

Raises:

MeilisearchApiError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

wait_for_task(uid: int, timeout_in_ms: int = 5000, interval_in_ms: int = 50) Task[source]

Wait until the task fails or succeeds in Meilisearch.

Parameters:
  • uid – Identifier of the task to wait for being processed.

  • (optional) (interval_in_ms) – Time the method should wait before raising a MeilisearchTimeoutError.

  • (optional) – Time interval the method should wait (sleep) between requests.

Returns:

Task instance containing information about the processed asynchronous task.

Return type:

task

Raises:

MeilisearchTimeoutError – An error containing details about why Meilisearch can’t process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors

meilisearch.version module

meilisearch.version.qualified_version() str[source]

Get the qualified version of this module.

Module contents