Catalyst::Model::Search::ElasticSearch - A simple Catalyst model to interface with Search::Elasticsearch
version 1.142550
package My::App; use strict; use warnings; use Catalyst; our $VERSION = '0.01'; __PACKAGE__->config( name => 'Test::App', 'Model::Search' => { nodes => 'localhost:9200', request_timeout => 30, max_requests => 10_000 } ); __PACKAGE__->setup; package My::App::Model::Search; use Moose; use namespace::autoclean; extends 'Catalyst::Model::Search::ElasticSearch'; __PACKAGE__->meta->make_immutable; 1; package My::App::Controller::Root; use base 'Catalyst::Controller'; __PACKAGE__->config(namespace => ''); sub search : Local { my ($self, $c) = @_; my $params = $c->req->params; my $search = $c->model('Search'); my $results = $search->search( index => 'test', type => 'test', body => { query => { term => { schpongle => $params->{'q'} } } } ); $c->stash( results => $results ); }
This is in very alpha stages. More testing and production use are coming up, but be warned until then.
A list of nodes to connect to.
The transport to use to interact with the Elasticsearch API. See Search::Elasticsearch::Transport for options.
Stores other key/value pairs to pass to Search::Elasticsearch.
The Search::Elasticsearch object.
The Catalyst Advent article on integrating Elasticsearch into your app: http://www.catalystframework.org/calendar/2010/2
Search::Elasticsearch - Elasticsearch interface this model provides access to
http://www.elasticsearch.org/ - Open Source Distributed Real Time Search and Analytics
Devin Austin <dhoss@cpan.org>
Manfred Stock <mstock@cpan.org>
This software is copyright (c) 2014 by Devin Austin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Catalyst::Model::Search::ElasticSearch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Model::Search::ElasticSearch
CPAN shell
perl -MCPAN -e shell install Catalyst::Model::Search::ElasticSearch
For more information on module installation, please visit the detailed CPAN module installation guide.