Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Search::Elasticsearch:UsertContributed PerSearch::Elasticsearch::TestServer(3)

NAME
       Search::Elasticsearch::TestServer - A helper class to launch
       Elasticsearch nodes

VERSION
       version 5.02

SYNOPSIS
	   use Search::Elasticsearch;
	   use Search::Elasticsearch::TestServer;

	   my $server =	Search::Elasticsearch::TestServer->new(
	       es_home	  => '/path/to/elasticsearch',
	       es_version => '5_0'
	   );

	   my $nodes = $server->start;
	   my $es    = Search::Elasticsearch->new( nodes => $nodes );
	   # run tests
	   $server->shutdown;

DESCRIPTION
       The Search::Elasticsearch::TestServer class can be used to launch one
       or more instances of Elasticsearch for testing purposes.	 The nodes
       will be shutdown	automatically.

METHODS
   "new()"
	   my $server =	Search::Elasticsearch::TestServer->new(
	       es_home	  => '/path/to/elasticsearch',
	       es_version => '5_0',
	       instances => 1,
	       http_port => 9600,
	       es_port	 => 9700,
	       conf	 => ['attr.foo=bar'],
	   );

       Params:

       o   "es_home"

	   Required. Must point	to the Elasticsearch home directory, which
	   contains "./bin/elasticsearch".

       o   "es_version"

	   Required. Accepts a version of the client, eg `5_0`,	`2_0`, `1_0`,
	   `0_90`

       o   "instances"

	   The number of nodes to start. Defaults to 1

       o   "http_port"

	   The port to use for HTTP. If	multiple instances are started,	the
	   "http_port" will be incremented for each subsequent instance.
	   Defaults to 9600.

       o   "es_port"

	   The port to use for Elasticsearch's internal	transport. If multiple
	   instances are started, the "es_port"	will be	incremented for	each
	   subsequent instance.	 Defaults to 9700

       o   "conf"

	   An array containing any extra startup options that should be	passed
	   to Elasticsearch.

"start()"
	   $nodes = $server->start;

       Starts the required instances and returns an array ref containing the
       IP and port of each node, suitable for passing to "new()" in
       Search::Elasticsearch:

	   $es = Search::Elasticsearch->new( nodes => $nodes );

"shutdown()"
	   $server->shutdown;

       Kills the running instances.  This will be called automatically when
       $server goes out	of scope or if the program receives a "SIGINT".

AUTHOR
       Clinton Gormley <drtech@cpan.org>

COPYRIGHT AND LICENSE
       This software is	Copyright (c) 2017 by Elasticsearch BV.

       This is free software, licensed under:

	 The Apache License, Version 2.0, January 2004

perl v5.24.1			  2017-04-Search::Elasticsearch::TestServer(3)

NAME | VERSION | SYNOPSIS | DESCRIPTION | METHODS | "start()" | "shutdown()" | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Search::Elasticsearch::TestServer&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help