Installation on my development station (a MacBook Air) was easy.
Next step is a perlish interface.
There are modules on CPAN interfacing to Elasticsearch, but with tons of dependencies, and a lot of documentation to learn.
What's about using the JSON REST-API of Elasticsearch directly with one of the perlish user agents?
Having Mojolicious installed on all machines, and knowing Mojo::UserAgent very well, I gave it a try.
Some minutes later I had it working:
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
# insert a record
my $tx = $ua->post('http://localhost:9200/nomen/child' => json =>
{
"taxon" => "Rosa",
"rank" => "Genus",
"child" => "Rosa canina",
"system" => "gbif"
}
);
# query
my $result = $ua->post('http://localhost:9200/_search' => json => {
"query" => {
"query_string" => {
"query" => "Spermophilus",
"fields" => ["taxon","child"]
}
}
})->res->json;
It allows to use perl structures directly with the built-in JSON converter.
Easy and simple.
Next will be scalability and performance tests.
Dieser Kommentar wurde vom Autor entfernt.
AntwortenLöschenThis is neat! You might want to have a look at Search::Elasticsearch for easier and more complete interaction with Elasticsearch.
AntwortenLöschenSearch::Elasticsearch is too heavy as I already wrote in my original post. It's not easier.
Löschen