The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Search::Elasticsearch::Util::API::QS - A utility class for query string parameters in the API

VERSION

version 2.03

DESCRIPTION

This class contains a definition of each query string parameter that can be accepted by actions in the API.

EXPORTS

qs_init()

    use Search::Elasticsearch::Util::API::QS qw(qs_init);
    $handler = qs_init( @qs_params );
    $qs_hash = $handler->($params);

The qs_init() sub accepts a list of query string parameter names, and returns a handler which can extract those parameters from \%params and return a hash of values to be passed as a query string.

For instance:

    $handler = qs_init(qw(fields size from));
    $params  = { fields =>['foo','bar'], size => 10, query=>\%query };
    $qs_hash = $handler->($params);

Would result in:

    $qs_hash: { fields => 'foo,bar', size => 10};
    $params:   { query => \%query }

register_qs()

    use Search::Elasticsearch::Util::API::QS qw(register_qs);

    register_qs( foo => { type => 'bool'},...)

Allows plugins to add query string parameter handlers.

AUTHOR

Clinton Gormley <drtech@cpan.org>

COPYRIGHT AND LICENSE

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

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004