{"id":13721760,"url":"https://github.com/sanders41/meilisearch-python-sdk","last_synced_at":"2026-01-18T09:45:05.384Z","repository":{"id":37930570,"uuid":"380803457","full_name":"sanders41/meilisearch-python-sdk","owner":"sanders41","description":"An async and sync Python client for the Meilisearch API ","archived":false,"fork":false,"pushed_at":"2025-04-10T18:47:01.000Z","size":9494,"stargazers_count":73,"open_issues_count":3,"forks_count":14,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T19:57:48.531Z","etag":null,"topics":["async","asyncio","client","meilisearch","python","sdk","search"],"latest_commit_sha":null,"homepage":"https://meilisearch-python-sdk.paulsanders.dev/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sanders41.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["sanders41"]}},"created_at":"2021-06-27T17:45:39.000Z","updated_at":"2025-04-10T18:47:03.000Z","dependencies_parsed_at":"2023-10-17T05:43:56.247Z","dependency_job_id":"c6996cf5-e13e-4c48-9a12-89c3097f01a0","html_url":"https://github.com/sanders41/meilisearch-python-sdk","commit_stats":{"total_commits":1549,"total_committers":15,"mean_commits":"103.26666666666667","dds":"0.46223369916074886","last_synced_commit":"34c56c50f768758b173bfbea44bb2c97301d575b"},"previous_names":["sanders41/meilisearch-python-sdk","sanders41/meilisearch-python-async"],"tags_count":94,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanders41%2Fmeilisearch-python-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanders41%2Fmeilisearch-python-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanders41%2Fmeilisearch-python-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanders41%2Fmeilisearch-python-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanders41","download_url":"https://codeload.github.com/sanders41/meilisearch-python-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248633690,"owners_count":21136902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","asyncio","client","meilisearch","python","sdk","search"],"created_at":"2024-08-03T01:01:21.035Z","updated_at":"2026-01-18T09:45:05.373Z","avatar_url":"https://github.com/sanders41.png","language":"Python","readme":"# Meilisearch Python SDK\n\n[![Tests Status](https://github.com/sanders41/meilisearch-python-sdk/actions/workflows/testing.yml/badge.svg?branch=main\u0026event=push)](https://github.com/sanders41/meilisearch-python-sdk/actions?query=workflow%3ATesting+branch%3Amain+event%3Apush)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sanders41/meilisearch-python-sdk/main.svg)](https://results.pre-commit.ci/latest/github/sanders41/meilisearch-python-sdk/main)\n[![Coverage](https://codecov.io/github/sanders41/meilisearch-python-sdk/coverage.svg?branch=main)](https://codecov.io/gh/sanders41/meilisearch-python-sdk)\n[![PyPI version](https://badge.fury.io/py/meilisearch-python-sdk.svg)](https://badge.fury.io/py/meilisearch-python-sdk)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/meilisearch-python-sdk?color=5cc141)](https://github.com/sanders41/meilisearch-python-sdk)\n\nMeilisearch Python SDK provides both an async and sync client for the\n[Meilisearch](https://github.com/meilisearch/meilisearch) API.\n\nWhich client to use depends on your use case. If the code base you are working with uses asyncio,\nfor example if you are using [FastAPI](https://fastapi.tiangolo.com/), choose the `AsyncClient`,\notherwise choose the sync `Client`. The functionality of the two clients is the same, the difference\nbeing that the `AsyncClient` provides async methods and uses the `AsyncIndex` with its own\nadditional async methods. On the other hand, `Client` provides blocking methods and uses the `Index`\nwith its own blocking methods.\n\n## Installation\n\nUsing a virtual environment is recommended for installing this package. Once the virtual\nenvironment is created and activated, install the package with:\n\n```sh\npip install meilisearch-python-sdk\n```\n\n## Run Meilisearch\n\nThere are several ways to\n[run Meilisearch](https://www.meilisearch.com/docs/learn/getting_started/installation).\nPick the one that works best for your use case and then start the server.\n\nAs as example to use Docker:\n\n```sh\ndocker pull getmeili/meilisearch:latest\ndocker run -it --rm -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey\n```\n\n## Usage\n\n### Add Documents\n\n#### AsyncClient\n\n- Note: `client.index(\"books\") creates an instance of an AsyncIndex object but does not make a\n  network call to send the data yet so it does not need to be awaited.\n\n```py\nfrom meilisearch_python_sdk import AsyncClient\n\nasync with AsyncClient('http://127.0.0.1:7700', 'masterKey') as client:\n    index = client.index(\"books\")\n\n    documents = [\n        {\"id\": 1, \"title\": \"Ready Player One\"},\n        {\"id\": 42, \"title\": \"The Hitchhiker's Guide to the Galaxy\"},\n    ]\n\n    await index.add_documents(documents)\n```\n\n#### Client\n\n```py\nfrom meilisearch_python_sdk import Client\n\nwith Client('http://127.0.0.1:7700', 'masterKey') as client:\n    index = client.index(\"books\")\n\n    documents = [\n        {\"id\": 1, \"title\": \"Ready Player One\"},\n        {\"id\": 42, \"title\": \"The Hitchhiker's Guide to the Galaxy\"},\n    ]\n\n    index.add_documents(documents)\n```\n\nThe server will return an update id that can be used to\n[get the status](https://www.meilisearch.com/docs/reference/api/tasks#status)\nof the updates. To do this you would save the result response from adding the documents to a\nvariable, this will be an `UpdateId` object, and use it to check the status of the updates.\n\n#### AsyncClient\n\n```py\ntask = await index.add_documents([{\"id\": 1, \"title\": \"test\"}])\nstatus = await client.get_task(task.task_uid)\n```\n\n#### Client\n\n```py\ntask = index.add_documents([{\"id\": 1, \"title\": \"test\"}])\nstatus = client.get_task(task.task_uid)\n```\n\n### Basic Searching\n\n#### AsyncClient\n\n```py\nsearch_result = await index.search(\"ready player\")\n```\n\n#### Client\n\n```py\nsearch_result = index.search(\"ready player\")\n```\n\n### Base Search Results: SearchResults object with values\n\n```py\nSearchResults(\n    hits = [\n        {\n            \"id\": 1,\n            \"title\": \"Ready Player One\",\n        },\n    ],\n    offset = 0,\n    limit = 20,\n    nb_hits = 1,\n    exhaustive_nb_hits = bool,\n    facets_distributionn = None,\n    processing_time_ms = 1,\n    query = \"ready player\",\n)\n```\n\n### Custom Search\n\nInformation about the parameters can be found in the\n[search parameters](https://docs.meilisearch.com/reference/features/search_parameters.html) section\nof the documentation.\n\n#### AsyncClient\n\n```py\nawait index.search(\n    \"guide\",\n    attributes_to_highlight=[\"title\"],\n    filters=\"book_id \u003e 10\"\n)\n```\n\n#### Client\n\n```py\nindex.search(\n    \"guide\",\n    attributes_to_highlight=[\"title\"],\n    filters=\"book_id \u003e 10\"\n)\n```\n\n### Custom Search Results: SearchResults object with values\n\n```py\nSearchResults(\n    hits = [\n        {\n            \"id\": 42,\n            \"title\": \"The Hitchhiker's Guide to the Galaxy\",\n            \"_formatted\": {\n                \"id\": 42,\n                \"title\": \"The Hitchhiker's Guide to the \u003cem\u003eGalaxy\u003c/em\u003e\"\n            }\n        },\n    ],\n    offset = 0,\n    limit = 20,\n    nb_hits = 1,\n    exhaustive_nb_hits = bool,\n    facets_distributionn = None,\n    processing_time_ms = 5,\n    query = \"galaxy\",\n)\n```\n\n## Benchmark\n\nThe following benchmarks compare this library to the official\n[Meilisearch Python](https://github.com/meilisearch/meilisearch-python) library. Note that all\nof the performance gains seen with the `AsyncClient` are achieved by taking advantage of asyncio.\nThis means that if your code is not taking advantage of asyncio or it does not block the event loop,\nthe gains here will not be seen and the performance between the clients will be very similar.\n\n### Add Documents in Batches\n\nThis test compares how long it takes to send 1 million documents in batches of 1 thousand to the\nMeilisearch server for indexing (lower is better). The time does not take into account how long\nMeilisearch takes to index the documents since that is outside of the library functionality.\n\n![Add Documents in Batches](https://raw.githubusercontent.com/sanders41/meilisearch-python-sdk/main/assets/add_in_batches.png)\n\n### Multiple Searches\n\nThis test compares how long it takes to complete 1000 searches (lower is better)\n\n![Multiple Searches](https://raw.githubusercontent.com/sanders41/meilisearch-python-sdk/main/assets/searches.png)\n\n### Independent testing\n\n[Prashanth Rao](https://github.com/prrao87) did some independent testing and found this async client\nto be ~30% faster than the sync client for data ingestion. You can find a good write-up of the\nresults how he tested them in his [blog post](https://thedataquarry.com/posts/meilisearch-async/).\n\n## Testing\n\n[pytest-meilisearch](https://github.com/sanders41/pytest-meilisearch) is a pytest plugin that can\nhelp with testing your code. It provides a lot of the boiler plate code you will need.\n\n## Documentation\n\nSee our [docs](https://meilisearch-python-sdk.paulsanders.dev) for the full documentation.\n\n## Contributing\n\nContributions to this project are welcome. If you are interested in contributing please see our\n[contributing guide](CONTRIBUTING.md)\n","funding_links":["https://github.com/sponsors/sanders41"],"categories":["Integrations","Python"],"sub_categories":["Community Integrations"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanders41%2Fmeilisearch-python-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanders41%2Fmeilisearch-python-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanders41%2Fmeilisearch-python-sdk/lists"}