Elastic::Model::Role::Store - Elasticsearch backend for document read/write requests
version 0.51
All document-related requests to the Elasticsearch backend are handled via Elastic::Model::Role::Store.
$es = $store->es
Returns the connection to Elasticsearch.
$result = $store->get_doc($uid, %args);
Retrieves the doc specified by the $uid from Elasticsearch, by calling "get()" in Search::Elasticsearch. Throws an exception if the document does not exist.
$bool = $store->doc_exists($uid, %args);
Checks whether the doc exists in ElastciSearch. Any %args are passed through to "exists()" in Search::Elasticsearch.
%args
$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 Search::Elasticsearch::Client::Direct
$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 Search::Elasticsearch::Client::Direct. For instance, to overwrite a document regardless of version number, you could do:
$result = $store->index_doc($uid => \%data, version => 0 );
$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 Search::Elasticsearch::Client::Direct.
$result = $store->bulk( actions => $actions, on_conflict => sub {...}, on_error => sub {...}, on_success => sub {...}, %args );
Performs several actions in a single request. Any %args will be passed to "bulk_helper()" in Search::Elasticsearch::Client::Direct.
$results = $store->search(@args);
Performs a search, passing @args to "search()" in Search::Elasticsearch::Client::Direct.
@args
$results = $store->scrolled_search(@args);
Performs a scrolled search, passing @args to "scroll_helper()" in Search::Elasticsearch::Client::Direct.
$response = $store->delete_by_query(@args);
Performs a delete-by-query, passing @args to "delete_by_query()" in Search::Elasticsearch::Client::Direct.
$bool = $store->index_exists(@args);
Checks whether the specified index exists, passing @args to "exists()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->create_index(@args);
Creates the specified index, passing @args to "create()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->delete_index(@args);
Deletes the specified index, passing @args to "delete()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->refresh_index(@args);
Refreshes the specified index, passing @args to "refresh()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->open_index(@args);
Opens the specified index, passing @args to "open()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->close_index(@args);
Closes the specified index, passing @args to "close()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->update_index_settings(@args);
Updates the settings of the specified index, passing @args to "update_settings()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->get_aliases(@args);
Retrieves the aliases for the specified indices, passing @args to "get_aliases()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->put_aliases(@args);
Updates the aliases for the specified indices, passing @args to "update_aliases()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->get_mapping(@args);
Retrieves the mappings for the specified index, passing @args to "get_mapping()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->put_mapping(@args);
Updates the mappings for the specified index, passing @args to "put_mapping()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->delete_mapping(@args);
Deletes the mappings and associated documents for the specified index, passing @args to "delete_mapping()" in Search::Elasticsearch::Client::Direct::Indices.
$response = $store->reindex(@args);
Passes the @args to "reindex()" in Search::Elasticsearch::Bulk.
$response = $store->bootstrap_uniques(@args);
Creates the index which will store unique constraints, unless it already exists.
$response = $store->create_unique_keys(@args);
Inserts the documents representing unique constraints, and throws an error if they already exist.
$response = $store->delete_unique_keys(@args);
Deletes the documents representing the specified unique constraints.
Clinton Gormley <drtech@cpan.org>
This software is copyright (c) 2015 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.
To install Elastic::Model, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Elastic::Model
CPAN shell
perl -MCPAN -e shell install Elastic::Model
For more information on module installation, please visit the detailed CPAN module installation guide.