written in order to take load of elasticsearch
Using tokio, sled and reqwests
Secretly written in order to slowly replace elasticsearch with 100% Rust power
$ git clone https://github.com/flipchan/powerelk
$ cd powerelk && cargo build --release
Edit powerelk.toml:
[host]
bind = "0.0.0.0"
port = 18080
elasticsearchindex = "myelkindex"
elasticsearchinstance = "http://0.0.0.0:9200"
cachelocation = "/tmp/mycache"
$ ./target/release/powerelk
Listening on http://0.0.0.0:1387
$ curl -v http://0.0.0.0:1387/search -d'{"search":fluff"}'
$ curl -v http://0.0.0.0:1387/removekey -d'{"search":"fluff"}'
$ curl -v http://0.0.0.0:1387/random -XGET
You can use Powerelk with Rust own Default::default
cat src/elk.rs
impl Default for Elk{
fn default() -> Self {
Self {
instance: "http://127.0.0.1:9200".into(),
index: "myindex".into(),}
}
}
cat src/database.rs
impl Default for Database {
fn default() -> Self {
Self {
filelocation: "/tmp/database.db".into(),
}
}
}
cat src/