1Search::Elasticsearch::UCsxenr::CLoWnPt(r3i)buted Perl DSoecaurmcehn:t:aEtliaosnticsearch::Cxn::LWP(3)
2
3
4

NAME

6       Search::Elasticsearch::Cxn::LWP - A Cxn implementation which uses LWP
7

VERSION

9       version 7.30
10

DESCRIPTION

12       Provides an HTTP Cxn class and based on LWP.  The LWP backend uses pure
13       Perl and persistent connections.
14
15       This class does Search::Elasticsearch::Role::Cxn, whose documentation
16       provides more information, and Search::Elasticsearch::Role::Is_Sync.
17

CONFIGURATION

19   Inherited configuration
20       From Search::Elasticsearch::Role::Cxn
21
22       •   node
23
24       •   max_content_length
25
26       •   deflate
27
28       •   deflate
29
30       •   request_timeout
31
32       •   ping_timeout
33
34       •   dead_timeout
35
36       •   max_dead_timeout
37
38       •   sniff_request_timeout
39
40       •   sniff_timeout
41
42       •   handle_args
43
44       •   handle_args
45

SSL/TLS

47       Search::Elasticsearch::Cxn::LWP uses IO::Socket::SSL to support HTTPS.
48       By default, no validation of the remote host is performed.
49
50       This behaviour can be changed by passing the "ssl_options" parameter
51       with any options accepted by IO::Socket::SSL. For instance, to check
52       that the remote host has a trusted certificate, and to avoid man-in-
53       the-middle attacks, you could do the following:
54
55           use Search::Elasticsearch;
56
57           my $es = Search::Elasticsearch->new(
58               cxn   => 'LWP',
59               nodes => [
60                   "https://node1.mydomain.com:9200",
61                   "https://node2.mydomain.com:9200",
62               ],
63               ssl_options => {
64                   verify_hostname     => 1,
65                   SSL_ca_file         => '/path/to/cacert.pem'
66               }
67           );
68
69       If the remote server cannot be verified, an
70       Search::Elasticsearch::Error will be thrown - LWP does not allow us to
71       detect that the connection error was due to invalid SSL.
72
73       If you want your client to present its own certificate to the remote
74       server, then use:
75
76           use Search::Elasticsearch;
77
78           my $es = Search::Elasticsearch->new(
79               cxn   => 'LWP',
80               nodes => [
81                   "https://node1.mydomain.com:9200",
82                   "https://node2.mydomain.com:9200",
83               ],
84               ssl_options => {
85                   verify_hostname     => 1,
86                   SSL_ca_file         => '/path/to/cacert.pem',
87                   SSL_use_cert        => 1,
88                   SSL_cert_file       => '/path/to/client.pem',
89                   SSL_key_file        => '/path/to/client.pem',
90               }
91           );
92

METHODS

94   "perform_request()"
95           ($status,$body) = $self->perform_request({
96               # required
97               method      => 'GET|HEAD|POST|PUT|DELETE',
98               path        => '/path/of/request',
99               qs          => \%query_string_params,
100
101               # optional
102               data        => $body_as_string,
103               mime_type   => 'application/json',
104               timeout     => $timeout
105           });
106
107       Sends the request to the associated Elasticsearch node and returns a
108       $status code and the decoded response $body, or throws an error if the
109       request failed.
110
111   Inherited methods
112       From Search::Elasticsearch::Role::Cxn
113
114scheme()
115
116is_https()
117
118userinfo()
119
120default_headers()
121
122max_content_length()
123
124build_uri()
125
126host()
127
128port()
129
130uri()
131
132is_dead()
133
134is_live()
135
136next_ping()
137
138ping_failures()
139
140mark_dead()
141
142mark_live()
143
144force_ping()
145
146pings_ok()
147
148sniff()
149
150process_response()
151

SEE ALSO

153       •   Search::Elasticsearch::Role::Cxn
154
155       •   Search::Elasticsearch::Cxn::HTTPTiny
156
157       •   Search::Elasticsearch::Cxn::NetCurl
158

AUTHOR

160       Enrico Zimuel <enrico.zimuel@elastic.co>
161
163       This software is Copyright (c) 2020 by Elasticsearch BV.
164
165       This is free software, licensed under:
166
167         The Apache License, Version 2.0, January 2004
168
169
170
171perl v5.32.1                      2021-01-27Search::Elasticsearch::Cxn::LWP(3)
Impressum