Skip to main content

The python client for MeiliSearch API.

Project description

MeiliSearch-Python

MeiliSearch Python

MeiliSearch | Documentation | Roadmap | Website | Blog | Twitter | FAQ

PyPI version Test Status License Slack Bors enabled

⚡ The MeiliSearch API client written for Python 🐍

MeiliSearch Python is the MeiliSearch API client for Python developers. MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine. Both searching and indexing are highly customizable. Features such as typo-tolerance, filters, facets, and synonyms are provided out-of-the-box.

Table of Contents

📖 Documentation

See our Documentation or our API References.

🔧 Installation

With pip3 in command line:

$ pip3 install meilisearch

Run MeiliSearch

There are many easy ways to download and run a MeiliSearch instance.

For example, if you use Docker:

$ docker pull getmeili/meilisearch:latest # Fetch the latest version of MeiliSearch image from Docker Hub
$ docker run -it --rm -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey

NB: you can also download MeiliSearch from Homebrew or APT.

🚀 Getting Started

Add Documents

import meilisearch

client = meilisearch.Client('http://127.0.0.1:7700', 'masterKey')

# An index is where the documents are stored.
index = client.index('books')

documents = [
  { 'book_id': 123,  'title': 'Pride and Prejudice' },
  { 'book_id': 456,  'title': 'Le Petit Prince' },
  { 'book_id': 1,    'title': 'Alice In Wonderland' },
  { 'book_id': 1344, 'title': 'The Hobbit' },
  { 'book_id': 4,    'title': 'Harry Potter and the Half-Blood Prince' },
  { 'book_id': 42,   'title': 'The Hitchhiker\'s Guide to the Galaxy' }
]

# If the index 'books' does not exist, MeiliSearch creates it when you first add the documents.
index.add_documents(documents) # => { "updateId": 0 }

With the updateId, you can check the status (enqueued, processed or failed) of your documents addition using the update endpoint.

Basic Search

# MeiliSearch is typo-tolerant:
index.search('harry pottre')

Output:

{
  "hits" => [{
    "book_id" => 4,
    "title" => "Harry Potter and the Half-Blood Prince"
  }],
  "offset" => 0,
  "limit" => 20,
  "processingTimeMs" => 1,
  "query" => "harry pottre"
}

Custom Search

All the supported options are described in the search parameters section of the documentation.

index.search(
  'prince',
  {
    'attributesToHighlight': ['title'],
    'filters': 'book_id > 10'
  }
)

JSON output:

{
    "hits": [
        {
            "book_id": 456,
            "title": "Le Petit Prince",
            "_formatted": {
                "book_id": 456,
                "title": "Le Petit <em>Prince</em>"
            }
        }
    ],
    "offset": 0,
    "limit": 20,
    "processingTimeMs": 10,
    "query": "prince"
}

🤖 Compatibility with MeiliSearch

This package only guarantees the compatibility with the version v0.17.0 of MeiliSearch.

💡 Learn More

The following sections may interest you:

⚙️ Development Workflow and Contributing

Any new contribution is more than welcome in this project!

If you want to know more about the development workflow or want to contribute, please visit our contributing guidelines for detailed instructions!


MeiliSearch provides and maintains many SDKs and Integration tools like this one. We want to provide everyone with an amazing search experience for any kind of project. If you want to contribute, make suggestions, or just know what's going on right now, visit us in the integration-guides repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meilisearch-0.14.0.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meilisearch-0.14.0-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file meilisearch-0.14.0.tar.gz.

File metadata

  • Download URL: meilisearch-0.14.0.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for meilisearch-0.14.0.tar.gz
Algorithm Hash digest
SHA256 04fd632d9d7b8d60bfbbc8004497015965960316c2e6cd18c2487540115a98c0
MD5 cf371cc796ade19ade2097d2099807a4
BLAKE2b-256 477d74ad5c9abaa783ef8e1ec3040bbe8d0d3a34d79aca1c8c4fa14bffdae0e5

See more details on using hashes here.

File details

Details for the file meilisearch-0.14.0-py3-none-any.whl.

File metadata

  • Download URL: meilisearch-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for meilisearch-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a2afe3294b9a9fa749806374ab618a3bc9c833f304a64049a04ae9dda7fa7a1
MD5 8f462b9b6d99bce5d24faf686044757e
BLAKE2b-256 0478aab2ec71d71173e985d21914c311d52d797e081f470fd8a95676ebfcb11c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page