NAME

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

VERSION

version 1.12

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 }

AUTHOR

Clinton Gormley <drtech@cpan.org>

COPYRIGHT AND LICENSE

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

This is free software, licensed under:

The Apache License, Version 2.0, January 2004