NAME
OpenSearch::Client::Role::Client::Direct - Request parsing for Direct clients
VERSION
version 3.007005
DESCRIPTION
This role provides the single parse_request() method for classes which need to parse an API definition from OpenSearch::Client::Role::API and convert it into a request which can be passed to "perform_request()" in OpenSearch::Client::Transport.
METHODS
perform_request()
$request = $client->parse_request(\%defn,\%params);
The %defn is a definition returned by "api()" in OpenSearch::Client::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".
parse_request() will turn the parameters that have been passed in into a path (via "path_init()" in OpenSearch::Client::Util::API::Path), a query-string hash (via "qs_init" in OpenSearch::Client::Util::API::QS) and will pass through a body value directly.
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:
$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.
MANUAL
Documentation index OpenSearch::Client::Manual
HISTORY
This distribution is derived from Search::Elasticsearch version 7.714. All subsequent changes are unique to this distribution.
AUTHOR
Mark Dootson <mdootson@cpan.org> ( current maintainer )
CREDITS
OpenSearch::Client is based on Search::Elasticsearch version 7.714 by Enrico Zimuel <enrico.zimuel@elastic.co>.
COPYRIGHT AND LICENSE
Copyright (C) 2026 by Mark Dootson ( this distribution )
Copyright (C) 2021 by Elasticsearch BV ( original distribution )
This is free software, licensed under:
The Apache License, Version 2.0, January 2004