1Search::Elasticsearch::UCsxenr::CHoTnTtPrTiibnuyt(e3d)PSeeralrcDho:c:uEmleansttaitcisoenarch::Cxn::HTTPTiny(3)
2
3
4
6 Search::Elasticsearch::Cxn::HTTPTiny - A Cxn implementation which uses
7 HTTP::Tiny
8
10 version 6.00
11
13 Provides the default HTTP Cxn class and is based on HTTP::Tiny. The
14 HTTP::Tiny backend is fast, uses pure Perl, support proxies and https
15 and provides persistent connections.
16
17 This class does Search::Elasticsearch::Role::Cxn, whose documentation
18 provides more information, and Search::Elasticsearch::Role::Is_Sync.
19
21 Inherited configuration
22 From Search::Elasticsearch::Role::Cxn
23
24 · node
25
26 · max_content_length
27
28 · deflate
29
30 · deflate
31
32 · request_timeout
33
34 · ping_timeout
35
36 · dead_timeout
37
38 · max_dead_timeout
39
40 · sniff_request_timeout
41
42 · sniff_timeout
43
44 · handle_args
45
46 · handle_args
47
49 Search::Elasticsearch::Cxn::HTTPTiny uses IO::Socket::SSL to support
50 HTTPS. By default, no validation of the remote host is performed.
51
52 This behaviour can be changed by passing the "ssl_options" parameter
53 with any options accepted by IO::Socket::SSL. For instance, to check
54 that the remote host has a trusted certificate, and to avoid man-in-
55 the-middle attacks, you could do the following:
56
57 use Search::Elasticsearch;
58 use IO::Socket::SSL;
59
60 my $es = Search::Elasticsearch->new(
61 nodes => [
62 "https://node1.mydomain.com:9200",
63 "https://node2.mydomain.com:9200",
64 ],
65 ssl_options => {
66 SSL_verify_mode => SSL_VERIFY_PEER,
67 SSL_ca_file => '/path/to/cacert.pem'
68 }
69 );
70
71 If the remote server cannot be verified, an
72 Search::Elasticsearch::Error will be thrown.
73
74 If you want your client to present its own certificate to the remote
75 server, then use:
76
77 use Search::Elasticsearch;
78 use IO::Socket::SSL;
79
80 my $es = Search::Elasticsearch->new(
81 nodes => [
82 "https://node1.mydomain.com:9200",
83 "https://node2.mydomain.com:9200",
84 ],
85 ssl_options => {
86 SSL_verify_mode => SSL_VERIFY_PEER,
87 SSL_use_cert => 1,
88 SSL_ca_file => '/path/to/cacert.pem',
89 SSL_cert_file => '/path/to/client.pem',
90 SSL_key_file => '/path/to/client.pem',
91 }
92 );
93
95 "perform_request()"
96 ($status,$body) = $self->perform_request({
97 # required
98 method => 'GET|HEAD|POST|PUT|DELETE',
99 path => '/path/of/request',
100 qs => \%query_string_params,
101
102 # optional
103 data => $body_as_string,
104 mime_type => 'application/json',
105 timeout => $timeout
106 });
107
108 Sends the request to the associated Elasticsearch node and returns a
109 $status code and the decoded response $body, or throws an error if the
110 request failed.
111
112 Inherited methods
113 From Search::Elasticsearch::Role::Cxn
114
115 · scheme()
116
117 · is_https()
118
119 · userinfo()
120
121 · default_headers()
122
123 · max_content_length()
124
125 · build_uri()
126
127 · host()
128
129 · port()
130
131 · uri()
132
133 · is_dead()
134
135 · is_live()
136
137 · next_ping()
138
139 · ping_failures()
140
141 · mark_dead()
142
143 · mark_live()
144
145 · force_ping()
146
147 · pings_ok()
148
149 · sniff()
150
151 · process_response()
152
154 · Search::Elasticsearch::Role::Cxn
155
156 · Search::Elasticsearch::Cxn::Hijk
157
158 · Search::Elasticsearch::Cxn::LWP
159
160 · Search::Elasticsearch::Cxn::NetCurl
161
163 Clinton Gormley <drtech@cpan.org>
164
166 This software is Copyright (c) 2017 by Elasticsearch BV.
167
168 This is free software, licensed under:
169
170 The Apache License, Version 2.0, January 2004
171
172
173
174perl v5.28.0 2017-1S1e-a1r4ch::Elasticsearch::Cxn::HTTPTiny(3)