Search::Elasticsearch::Util::API::Path(3)

NAME
Search::Elasticsearch::Util::API::Path - A utility class for converting path templates into real paths

VERSION
version 2.00

DESCRIPTION
This module converts path templates in Search::Elasticsearch::Role::API such as "/{index}/{type}/{id}" into real paths such as "/my_index/my_type/123".

EXPORTS

  "path_init()"
    use Search::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 };

AUTHOR
Clinton Gormley <drtech@cpan.org>

COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Elasticsearch BV.

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004