Search::Elasticsearch::Cxn::AEHTTP - An async Cxn implementation which uses AnyEvent::HTTP
version 8.00
Provides the default async HTTP Cxn class and is based on AnyEvent::HTTP. The AEHTTP backend is fast, uses pure Perl, support proxies and https and provides persistent connections.
This class does Search::Elasticsearch::Role::Cxn, whose documentation provides more information, Search::Elasticsearch::Role::Async::Cxn, and Search::Elasticsearch::Role::Is_Async.
From Search::Elasticsearch::Role::Cxn
node
max_content_length
deflate
request_timeout
ping_timeout
dead_timeout
max_dead_timeout
sniff_request_timeout
sniff_timeout
handle_args
Search::Elasticsearch::Cxn::AEHTTP uses AnyEvent::TLS to support HTTPS. By default, no validation of the remote host is performed.
This behaviour can be changed by passing the ssl_options parameter with any options accepted by AnyEvent::TLS. For instance, to check that the remote host has a trusted certificate, and to avoid man-in-the-middle attacks, you could do the following:
ssl_options
use Search::Elasticsearch::Async; my $es = Search::Elasticsearch::Async->new( nodes => [ "https://node1.mydomain.com:9200", "https://node2.mydomain.com:9200", ], ssl_options => { verify => 1, verify_peername => 'https' ca_file => '/path/to/cacert.pem' } );
If the remote server cannot be verified, an Search::Elasticsearch::Error will be thrown.
If you want your client to present its own certificate to the remote server, then use:
use Search::Elasticsearch::Async; my $es = Search::Elasticsearch::Async->new( nodes => [ "https://node1.mydomain.com:9200", "https://node2.mydomain.com:9200", ], ssl_options => { verify => 1, verify_peername => 'https' ca_file => '/path/to/cacert.pem' cert_file => '/path/to/client.pem', } );
perform_request()
$self->perform_request({ # required method => 'GET|HEAD|POST|PUT|DELETE', path => '/path/of/request', qs => \%query_string_params, # optional data => $body_as_string, mime_type => 'application/json', timeout => $timeout }) ->then(sub { my ($status,body) = @_; ...})
Sends the request to the associated Elasticsearch node and returns a $status code and the decoded response $body, or throws an error if the request failed.
$status
$body
scheme()
is_https()
userinfo()
default_headers()
max_content_length()
build_uri()
host()
port()
uri()
is_dead()
is_live()
next_ping()
ping_failures()
mark_dead()
mark_live()
force_ping()
pings_ok()
sniff()
process_response()
From Search::Elasticsearch::Role::Async::Cxn
Search::Elasticsearch::Role::Cxn::Mojo
Enrico Zimuel <enrico.zimuel@elastic.co>
This software is Copyright (c) 2022 by Elasticsearch BV.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Search::Elasticsearch::Async, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Search::Elasticsearch::Async
CPAN shell
perl -MCPAN -e shell install Search::Elasticsearch::Async
For more information on module installation, please visit the detailed CPAN module installation guide.