NAME

Search::Elasticsearch::Cxn::Mojo - An async Cxn implementation which uses Mojo::UserAgent

VERSION

version 1.11

DESCRIPTION

Provides an async HTTP Cxn class based on Mojo::UserAgent. The Mojo backend is fast, uses pure Perl, support proxies and https and provides persistent connections.

This class does Search::Elasticsearch::Role::Cxn::HTTP, whose documentation provides more information, Search::Elasticsearch::Role::Async::Cxn, Search::Elasticsearch::Role::Cxn and Search::Elasticsearch::Role::Is_Async.

CONFIGURATION

connect_timeout

Unlike most HTTP backends, Mojo::UserAgent accepts a separate connect_timeout parameter, which defaults to 2 seconds but can be reduced in an environment with low network latency.

Inherited configuration

From Search::Elasticsearch::Role::Cxn::HTTP

From Search::Elasticsearch::Role::Cxn

METHODS

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.

Inherited methods

From Search::Elasticsearch::Role::Cxn::HTTP

From Search::Elasticsearch::Role::Async::Cxn

From Search::Elasticsearch::Role::Cxn

SEE ALSO

AUTHOR

Clinton Gormley <drtech@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2014 by Elasticsearch BV.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004