{"id":13721493,"url":"https://github.com/meilisearch/meilisearch-rust","last_synced_at":"2025-12-12T15:04:46.736Z","repository":{"id":37947730,"uuid":"260656751","full_name":"meilisearch/meilisearch-rust","owner":"meilisearch","description":"Rust wrapper for the Meilisearch API.","archived":false,"fork":false,"pushed_at":"2025-04-28T13:24:41.000Z","size":1533,"stargazers_count":384,"open_issues_count":49,"forks_count":95,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-11T07:53:15.357Z","etag":null,"topics":["crate","meilisearch","rust","sdk","search-engine","wasm"],"latest_commit_sha":null,"homepage":"https://www.meilisearch.com","language":"Rust","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/meilisearch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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}},"created_at":"2020-05-02T09:46:55.000Z","updated_at":"2025-05-10T07:57:42.000Z","dependencies_parsed_at":"2023-09-27T17:45:29.212Z","dependency_job_id":"6c86fb9c-223a-4da8-a476-fe552535ffc2","html_url":"https://github.com/meilisearch/meilisearch-rust","commit_stats":null,"previous_names":["meilisearch/meilisearch-sdk"],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meilisearch%2Fmeilisearch-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meilisearch%2Fmeilisearch-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meilisearch%2Fmeilisearch-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meilisearch%2Fmeilisearch-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meilisearch","download_url":"https://codeload.github.com/meilisearch/meilisearch-rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254120179,"owners_count":22017953,"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":["crate","meilisearch","rust","sdk","search-engine","wasm"],"created_at":"2024-08-03T01:01:17.832Z","updated_at":"2025-12-12T15:04:46.728Z","avatar_url":"https://github.com/meilisearch.png","language":"Rust","funding_links":[],"categories":["Rust","rust","Integrations"],"sub_categories":["Official Integrations"],"readme":"\u003c!-- Do NOT update manually the README.md file --\u003e\n\u003c!-- Update the README.tpl or src/lib.rs files instead, and run: --\u003e\n\u003c!-- sh scripts/update-readme.sh --\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/meilisearch/integration-guides/main/assets/logos/meilisearch_rust.svg\" alt=\"Meilisearch-Rust\" width=\"200\" height=\"200\" /\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eMeilisearch Rust SDK\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003e\n  \u003ca href=\"https://github.com/meilisearch/meilisearch\"\u003eMeilisearch\u003c/a\u003e |\n  \u003ca href=\"https://www.meilisearch.com/cloud?utm_campaign=oss\u0026utm_source=github\u0026utm_medium=meilisearch-rust\"\u003eMeilisearch Cloud\u003c/a\u003e |\n  \u003ca href=\"https://www.meilisearch.com/docs\"\u003eDocumentation\u003c/a\u003e |\n  \u003ca href=\"https://discord.meilisearch.com\"\u003eDiscord\u003c/a\u003e |\n  \u003ca href=\"https://roadmap.meilisearch.com/tabs/1-under-consideration\"\u003eRoadmap\u003c/a\u003e |\n  \u003ca href=\"https://www.meilisearch.com\"\u003eWebsite\u003c/a\u003e |\n  \u003ca href=\"https://www.meilisearch.com/docs/faq\"\u003eFAQ\u003c/a\u003e\n\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://crates.io/crates/meilisearch-sdk\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/meilisearch-sdk.svg\" alt=\"crates.io\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/meilisearch/meilisearch-rust/actions\"\u003e\u003cimg src=\"https://github.com/meilisearch/meilisearch-rust/workflows/Tests/badge.svg?branch=main\" alt=\"Tests\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/meilisearch/meilisearch-rust/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-informational\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/meilisearch/meilisearch/discussions\" alt=\"Discussions\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-discussions-red\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/meilisearch/meilisearch-rust\"\u003e\u003cimg src=\"https://codecov.io/gh/meilisearch/meilisearch-rust/graph/badge.svg?token=NVO9OI8JMG\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e⚡ The Meilisearch API client written for Rust 🦀\u003c/p\u003e\n\n**Meilisearch Rust** is the Meilisearch API client for Rust developers.\n\n**Meilisearch** is an open-source search engine. [Learn more about Meilisearch.](https://github.com/meilisearch/meilisearch)\n\n## Table of Contents \u003c!-- omit in TOC --\u003e\n\n- [📖 Documentation](#-documentation)\n- [🔧 Installation](#-installation)\n- [🚀 Getting started](#-getting-started)\n- [🌐 Running in the Browser with WASM](#-running-in-the-browser-with-wasm)\n- [🤖 Compatibility with Meilisearch](#-compatibility-with-meilisearch)\n- [⚙️ Contributing](#️-contributing)\n\n## 📖 Documentation\n\nThis readme contains all the documentation you need to start using this Meilisearch SDK.\n\nFor general information on how to use Meilisearch—such as our API reference, tutorials, guides, and in-depth articles—refer to our [main documentation website](https://www.meilisearch.com/docs).\n\n## 🔧 Installation\n\nTo use `meilisearch-sdk`, add this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nmeilisearch-sdk = \"0.31.0\"\n```\n\nThe following optional dependencies may also be useful:\n\n```toml\nfutures = \"0.3\" # To be able to block on async functions if you are not using an async runtime\nserde = { version = \"1.0\", features = [\"derive\"] }\n```\n\nThis crate is `async` but you can choose to use an async runtime like [tokio](https://crates.io/crates/tokio) or just [block on futures](https://docs.rs/futures/latest/futures/executor/fn.block_on.html).\nYou can enable the `sync` feature to make most structs `Sync`. It may be a bit slower.\n\nUsing this crate is possible without [serde](https://crates.io/crates/serde), but a lot of features require serde.\n\n### Run Meilisearch \u003c!-- omit in toc --\u003e\n\n⚡️ **Launch, scale, and streamline in minutes with Meilisearch Cloud**—no maintenance, no commitment, cancel anytime. [Try it free now](https://cloud.meilisearch.com/login?utm_campaign=oss\u0026utm_source=github\u0026utm_medium=meilisearch-rust).\n\n🪨  Prefer to self-host? [Download and deploy](https://www.meilisearch.com/docs/learn/self_hosted/getting_started_with_self_hosted_meilisearch?utm_campaign=oss\u0026utm_source=github\u0026utm_medium=meilisearch-rust) our fast, open-source search engine on your own infrastructure.\n\n## 🚀 Getting started\n\n#### Add Documents \u003c!-- omit in TOC --\u003e\n\n```rust\nuse meilisearch_sdk::client::*;\nuse serde::{Serialize, Deserialize};\nuse futures::executor::block_on;\n\n#[derive(Serialize, Deserialize, Debug)]\nstruct Movie {\n    id: usize,\n    title: String,\n    genres: Vec\u003cString\u003e,\n}\n\n\n#[tokio::main(flavor = \"current_thread\")]\nasync fn main() {\n    // Create a client (without sending any request so that can't fail)\n    let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();\n\n    // An index is where the documents are stored.\n    let movies = client.index(\"movies\");\n\n    // Add some movies in the index. If the index 'movies' does not exist, Meilisearch creates it when you first add the documents.\n    movies.add_documents(\u0026[\n        Movie { id: 1, title: String::from(\"Carol\"), genres: vec![\"Romance\".to_string(), \"Drama\".to_string()] },\n        Movie { id: 2, title: String::from(\"Wonder Woman\"), genres: vec![\"Action\".to_string(), \"Adventure\".to_string()] },\n        Movie { id: 3, title: String::from(\"Life of Pi\"), genres: vec![\"Adventure\".to_string(), \"Drama\".to_string()] },\n        Movie { id: 4, title: String::from(\"Mad Max\"), genres: vec![\"Adventure\".to_string(), \"Science Fiction\".to_string()] },\n        Movie { id: 5, title: String::from(\"Moana\"), genres: vec![\"Fantasy\".to_string(), \"Action\".to_string()] },\n        Movie { id: 6, title: String::from(\"Philadelphia\"), genres: vec![\"Drama\".to_string()] },\n    ], Some(\"id\")).await.unwrap();\n}\n```\n\nWith the `uid`, you can check the status (`enqueued`, `canceled`, `processing`, `succeeded` or `failed`) of your documents addition using the [task](https://www.meilisearch.com/docs/reference/api/tasks#get-task).\n\n#### Basic Search \u003c!-- omit in TOC --\u003e\n\n```rust\n// Meilisearch is typo-tolerant:\nprintln!(\"{:?}\", client.index(\"movies_2\").search().with_query(\"caorl\").execute::\u003cMovie\u003e().await.unwrap().hits);\n```\n\nOutput:\n```\n[Movie { id: 1, title: String::from(\"Carol\"), genres: vec![\"Romance\", \"Drama\"] }]\n```\n\nJson output:\n```json\n{\n  \"hits\": [{\n    \"id\": 1,\n    \"title\": \"Carol\",\n    \"genres\": [\"Romance\", \"Drama\"]\n  }],\n  \"offset\": 0,\n  \"limit\": 10,\n  \"processingTimeMs\": 1,\n  \"query\": \"caorl\"\n}\n```\n\n#### Custom Search \u003c!-- omit in toc --\u003e\n\n```rust\nlet search_result = client.index(\"movies_3\")\n  .search()\n  .with_query(\"phil\")\n  .with_attributes_to_highlight(Selectors::Some(\u0026[\"*\"]))\n  .execute::\u003cMovie\u003e()\n  .await\n  .unwrap();\nprintln!(\"{:?}\", search_result.hits);\n```\n\nJson output:\n```json\n{\n    \"hits\": [\n        {\n            \"id\": 6,\n            \"title\": \"Philadelphia\",\n            \"_formatted\": {\n                \"id\": 6,\n                \"title\": \"\u003cem\u003ePhil\u003c/em\u003eadelphia\",\n                \"genre\": [\"Drama\"]\n            }\n        }\n    ],\n    \"offset\": 0,\n    \"limit\": 20,\n    \"processingTimeMs\": 0,\n    \"query\": \"phil\"\n}\n```\n\n#### Custom Search With Filters \u003c!-- omit in TOC --\u003e\n\nIf you want to enable filtering, you must add your attributes to the `filterableAttributes`\nindex setting.\n\n```rust\nlet filterable_attributes = [\n    \"id\",\n    \"genres\",\n];\nclient.index(\"movies_4\").set_filterable_attributes(\u0026filterable_attributes).await.unwrap();\n```\n\nYou only need to perform this operation once.\n\nNote that Meilisearch will rebuild your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take time. You can track the process using the [tasks](https://www.meilisearch.com/docs/reference/api/tasks#get-task).\n\nThen, you can perform the search:\n\n```rust\nlet search_result = client.index(\"movies_5\")\n  .search()\n  .with_query(\"wonder\")\n  .with_filter(\"id \u003e 1 AND genres = Action\")\n  .execute::\u003cMovie\u003e()\n  .await\n  .unwrap();\nprintln!(\"{:?}\", search_result.hits);\n```\n\nJson output:\n```json\n{\n  \"hits\": [\n    {\n      \"id\": 2,\n      \"title\": \"Wonder Woman\",\n      \"genres\": [\"Action\", \"Adventure\"]\n    }\n  ],\n  \"offset\": 0,\n  \"limit\": 20,\n  \"estimatedTotalHits\": 1,\n  \"processingTimeMs\": 0,\n  \"query\": \"wonder\"\n}\n```\n\n#### Customize the `HttpClient` \u003c!-- omit in TOC --\u003e\n\nBy default, the SDK uses [`reqwest`](https://docs.rs/reqwest/latest/reqwest/) to make http calls.\nThe SDK lets you customize the http client by implementing the `HttpClient` trait yourself and\ninitializing the `Client` with the `new_with_client` method.\nYou may be interested by the `futures-unsend` feature which lets you specify a non-Send http client.\n\n#### Wasm support \u003c!-- omit in TOC --\u003e\n\nThe SDK supports wasm through reqwest. You'll need to enable the `futures-unsend` feature while importing it, though.\n\n## 🌐 Running in the Browser with WASM \u003c!-- omit in TOC --\u003e\n\nThis crate fully supports WASM.\n\nThe only difference between the WASM and the native version is that the native version has one more variant (`Error::Http`) in the Error enum. That should not matter so much but we could add this variant in WASM too.\n\nHowever, making a program intended to run in a web browser requires a **very** different design than a CLI program. To see an example of a simple Rust web app using Meilisearch, see the [our demo](./examples/web_app).\n\nWARNING: `meilisearch-sdk` will panic if no Window is available (ex: Web extension).\n\n## 🤖 Compatibility with Meilisearch\n\nThis package guarantees compatibility with [version v1.x of Meilisearch](https://github.com/meilisearch/meilisearch/releases/latest), but some features may not be present. Please check the [issues](https://github.com/meilisearch/meilisearch-rust/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+label%3Aenhancement) for more info.\n\n## ⚙️ Contributing\n\nAny new contribution is more than welcome in this project!\n\nIf you want to know more about the development workflow or want to contribute, please visit our [contributing guidelines](/CONTRIBUTING.md) for detailed instructions!\n\n\u003chr\u003e\n\n**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](https://github.com/meilisearch/integration-guides) repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeilisearch%2Fmeilisearch-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeilisearch%2Fmeilisearch-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeilisearch%2Fmeilisearch-rust/lists"}