Elasticsearch::Role::Client::Direct - Request parsing for Direct clients
version 1.05
This role provides the single parse_request() method for classes which need to parse an API definition from Elasticsearch::Role::API and convert it into a request which can be passed to "perform_request()" in Elasticsearch::Transport.
parse_request()
perform_request()
$request = $client->parse_request(\%defn,\%params);
The %defn is a definition returned by "api()" in Elasticsearch::Role::API with an extra key name which should be the name of the method that was called on the client. For instance if the user calls $client->search, then the name should be "search".
%defn
name
$client->search
"search"
parse_request() will turn the parameters that have been passed in into a path (via "path_init()" in Elasticsearch::Util::API::Path), a query-string hash (via "qs_init" in Elasticsearch::Util::API::QS) and will through a body value directly.
path
body
NOTE: If a path key is specified in the %params then it will be used directly, instead of trying to build path from the path template. Similarly, if a params key is specified in the %params, then it will be used as a basis for the query string hash. For instance:
%params
params
$client->perform_request( { method => 'GET', name => 'new_method' }, { path => '/new/method', params => { foo => 'bar' }, body => \%body } );
This makes it easy to add support for custom plugins or new functionality not yet supported by the released client.
Clinton Gormley <drtech@cpan.org>
This software is Copyright (c) 2014 by Elasticsearch BV.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Elasticsearch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Elasticsearch
CPAN shell
perl -MCPAN -e shell install Elasticsearch
For more information on module installation, please visit the detailed CPAN module installation guide.