1Search::Elasticsearch::UTseesrtSCeornvterri(b3u)ted PerlSeDaorccuhm:e:nEtlaatsitoincsearch::TestServer(3)
2
3
4

NAME

6       Search::Elasticsearch::TestServer - A helper class to launch
7       Elasticsearch nodes
8

VERSION

10       version 6.81
11

SYNOPSIS

13           use Search::Elasticsearch;
14           use Search::Elasticsearch::TestServer;
15
16           my $server = Search::Elasticsearch::TestServer->new(
17               es_home    => '/path/to/elasticsearch',  # defaults to $ENV{ES_HOME}
18               es_version => '6_0'                      # defaults to $ENV{ES_VERSION}
19           );
20
21           my $nodes = $server->start;
22           my $es    = Search::Elasticsearch->new( nodes => $nodes );
23           # run tests
24           $server->shutdown;
25

DESCRIPTION

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

METHODS

32   "new()"
33           my $server = Search::Elasticsearch::TestServer->new(
34               es_home    => '/path/to/elasticsearch',
35               es_version => '6_0',
36               instances => 1,
37               http_port => 9600,
38               es_port   => 9700,
39               conf      => ['attr.foo=bar'],
40           );
41
42       Params:
43
44       ·   "es_home"
45
46           Required. Must point to the Elasticsearch home directory, which
47           contains "./bin/elasticsearch".  Defaults to $ENV{ES_HOME}
48
49       ·   "es_version"
50
51           Required. Accepts a version of the client, eg `6_0`, `5_0`, `2_0`,
52           `1_0`, `0_90`.  Defaults to $ENV{ES_VERSION}.
53
54       ·   "instances"
55
56           The number of nodes to start. Defaults to 1
57
58       ·   "http_port"
59
60           The port to use for HTTP. If multiple instances are started, the
61           "http_port" will be incremented for each subsequent instance.
62           Defaults to 9600.
63
64       ·   "es_port"
65
66           The port to use for Elasticsearch's internal transport. If multiple
67           instances are started, the "es_port" will be incremented for each
68           subsequent instance.  Defaults to 9700
69
70       ·   "conf"
71
72           An array containing any extra startup options that should be passed
73           to Elasticsearch.
74

"start()"

76           $nodes = $server->start;
77
78       Starts the required instances and returns an array ref containing the
79       IP and port of each node, suitable for passing to "new()" in
80       Search::Elasticsearch:
81
82           $es = Search::Elasticsearch->new( nodes => $nodes );
83

"shutdown()"

85           $server->shutdown;
86
87       Kills the running instances.  This will be called automatically when
88       $server goes out of scope or if the program receives a "SIGINT".
89

AUTHOR

91       Enrico Zimuel <enrico.zimuel@elastic.co>
92
94       This software is Copyright (c) 2020 by Elasticsearch BV.
95
96       This is free software, licensed under:
97
98         The Apache License, Version 2.0, January 2004
99
100
101
102perl v5.32.0                      2020-07-2S8earch::Elasticsearch::TestServer(3)
Impressum