published on in API cpan elasticsearch metacpan perl Perl Mongers REST

How to set up your own PerlMongers web service in 10 minutes or less

I've been working with ElasticSearch over the past months as part of the MetaCPAN project. Using ElasticSearch as our back end has worked out really well so far. The reason is that, out of the box, it provides a REST API. So, in our case, we've been able to concentrate on writing code and not on designing an API, defining its behaviour, arguing over URL schemes etc.

To be clear, ES is not written in Perl, but there is a handy Perl module you can use to get yourself up and running in *minutes*.

Comments

Author: Clinton Gormley

Date: 02/11/2011 11:03:44 AM

Hi Oalders

nice post!

One question: why do you encode to UTF8? That should be handled by ElasticSearch.pm. Did you see any issues with encoding? I tried deleting that block and rerunning the script, and the encoding seems fine.

ta

Clint


Author: Olaf Alders

Date: 02/11/2011 12:44:02 PM

Hi Clinton,

I’ve put up a gist with the error: https://gist.github.com/822286. It went away after I handled the encoding, but from the error message, I really couldn’t tell exactly what the issue was.

Thanks,

Olaf


Author: Clinton Gormley

Date: 02/11/2011 02:48:51 PM

Hmmm,that’s weird. Especially as that particular entry has only ASCII characters.

What’s the error you get in the elasticsearch log?

I wonder if this is a version thing - what version of Perl , XML::Simple, WWW::Mechanize and WWW::Mechanize::Cached are you using?

clint


Author: Olaf Alders

Date: 02/11/2011 03:52:29 PM

Hi Clint,

I’ve updated the Gist with the server errors. You are correct about the modules. When I switch from Mechanize::Cached to Mechanize, I no longer need to encode. Weird.

Olaf