This module converts path templates in Elasticsearch::Role::API such as /{index}/{type}/{id}
into real paths such as /my_index/my_type/123
.
path_init()
use Elasticsearch::Util::API::Path qw(path_init); $handler = path_init($template); $path = $handler->(\%params);
The path_init()
sub accepts a path template and returns an anonymous sub which converts \%params
into a real path, removing the keys that it has used from %params
, eg:
$handler = path_init('/{indices}/_search'); $params = { index => ['foo','bar'], size => 10 }; $path = $handler->($params);
Would result in:
$path: '/foo,bar/_search'; $params: { size => 10 };