Crate meilisearch_api_client
source ·Expand description
A well designed api client for MeiliSearch.
CAVEAT: WIP
Quick Start
To get you started quickly, the easiest and highest-level way to create
index is to use [create_index
];
use meilisearch_api_client::{Config, client::Client, CreateIndexRequest};
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
let uid = "demo".to_string();
let name = "demoname".to_string();
// construct a request param
let req_data = CreateIndexRequest { uid, name, primary_key: None};
// config contains MeiliSearch server's host and port
let config = Config::new("http://127.0.0.1".to_string(), 7700);
// Client is api interface, using async/await.
let res = Client::new(config).create_index(req_data).await;
match res {
Ok(index) => {
println!("ceate index: {:?}", index);
},
Err(err) => {
println!("err: {:?}", err);
}
}
Ok(())
}
Output:
{"name":"demoname","uid":"demo","createdAt":"2020-05-14T08:56:24.483670375Z","updatedAt":"2020-05-14T08:56:24.484410846Z","primaryKey":null}
Installation
This crate requires a MeiliSearch server to run. See here to install and run MeiliSearch.
For the user guide and further documentation, can be found
here
Modules
- Module containing all the api interfaces
- Module containing ServiceError
Structs
- Including sever’s host and port
- Including create index’s params
- Including delete index’s params
- Including add documents request params
- Including documents related response
- Index structure
- Collection of Indexes
- Including update index’s params
Traits
- Userdefined Document MUST impl