NAME
Elastic::Model::Role::Store - ElasticSearch backend for document read/write requests
VERSION
version 0.04
DESCRIPTION
All document-related requests to the ElasticSearch backend are handled via Elastic::Model::Role::Store.
ATTRIBUTES
es
$es = $store->es
Returns the connection to ElasticSearch.
METHODS
get_doc()
$result = $store->get_doc($uid, %args);
Retrieves the doc specified by the $uid from ElasticSearch, by calling "get()" in ElasticSearch. Throws an exception if the document does not exist.
doc_exists()
$bool = $store->doc_exists($uid, %args);
Checks whether the doc exists in ElastciSearch. Any %args
are passed through to "exists()" in ElasticSearch.
create_doc()
$result = $store->create_doc($uid => \%data, %args);
Creates a doc in the ElasticSearch backend and returns the raw result. Throws an exception if a doc with the same $uid already exists. Any %args
are passed to "create()" in ElasticSearch
index_doc()
$result = $store->index_doc($uid => \%data, %args);
Updates (or creates) a doc in the ElasticSearch backend and returns the raw result. Any failure throws an exception. If the version number does not match what is stored in ElasticSearch, then a conflict exception will be thrown. Any %args
will be passed to "index()" in ElasticSearch. For instance, to overwrite a document regardless of version number, you could do:
$result = $store->index_doc($uid => \%data, version => 0 );
delete_doc()
$result = $store->delete_doc($uid, %args);
Deletes a doc in the ElasticSearch backend and returns the raw result. Any failure throws an exception. If the version number does not match what is stored in ElasticSearch, then a conflict exception will be thrown. Any %args
will be passed to "delete()" in ElasticSearch.
search()
$results = $store->search(@args);
Performs a search, passing @args
to "search()" in ElasticSearch.
scrolled_search()
$results = $store->scrolled_search(@args);
Performs a scrolled search, passing @args
to "scrolled_search()" in ElasticSearch.
AUTHOR
Clinton Gormley <drtech@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Clinton Gormley.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.