ElasticSearch::TestServer - Start an ElasticSearh cluster for testing
use ElasticSearch::TestServer; $ENV{ES_HOME} = '/path/to/elasticsearch'; $ENV{ES_TRANSPORT} = 'http'; my $es = connect_to_es(); OR my $es = connect_to_es( home => '/path/to/elasticsearch', instances => 3, transport => 'http', ip => '127.0.0.1', trace_calls => 'logfile', port => '9200', config => { values to override} );
ElasticSearch::TestServer is a utility module which will start an ElasticSearch cluster intended for testing, and shut the cluster down at the end, even if your code exits abnormally.
By default, it uses http transport, the local gateway, and starts 3 instances on localhost, starting with port 9200 if the transport is http, httplite or httptiny, or 9500 if thrift.
http
local
localhost
port
transport
httplite
httptiny
thrift
connect_to_es returns an ElasticSearch instance.
connect_to_es
Clinton Gormley, <clinton@traveljury.com>
Copyright (C) 2011 by Clinton Gormley
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
To install ElasticSearch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ElasticSearch
CPAN shell
perl -MCPAN -e shell install ElasticSearch
For more information on module installation, please visit the detailed CPAN module installation guide.