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

NAME

Elastic::Model::Role::Store - Elasticsearch backend for document read/write requests

VERSION

version 0.51

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 Search::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 Search::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 Search::Elasticsearch::Client::Direct

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 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 );

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 Search::Elasticsearch::Client::Direct.

bulk()

    $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.

search()

    $results = $store->search(@args);

Performs a search, passing @args to "search()" in Search::Elasticsearch::Client::Direct.

scrolled_search()

    $results = $store->scrolled_search(@args);

Performs a scrolled search, passing @args to "scroll_helper()" in Search::Elasticsearch::Client::Direct.

delete_by_query()

    $response = $store->delete_by_query(@args);

Performs a delete-by-query, passing @args to "delete_by_query()" in Search::Elasticsearch::Client::Direct.

index_exists()

    $bool = $store->index_exists(@args);

Checks whether the specified index exists, passing @args to "exists()" in Search::Elasticsearch::Client::Direct::Indices.

create_index()

    $response = $store->create_index(@args);

Creates the specified index, passing @args to "create()" in Search::Elasticsearch::Client::Direct::Indices.

delete_index()

    $response = $store->delete_index(@args);

Deletes the specified index, passing @args to "delete()" in Search::Elasticsearch::Client::Direct::Indices.

refresh_index()

    $response = $store->refresh_index(@args);

Refreshes the specified index, passing @args to "refresh()" in Search::Elasticsearch::Client::Direct::Indices.

open_index()

    $response = $store->open_index(@args);

Opens the specified index, passing @args to "open()" in Search::Elasticsearch::Client::Direct::Indices.

close_index()

    $response = $store->close_index(@args);

Closes the specified index, passing @args to "close()" in Search::Elasticsearch::Client::Direct::Indices.

update_index_settings()

    $response = $store->update_index_settings(@args);

Updates the settings of the specified index, passing @args to "update_settings()" in Search::Elasticsearch::Client::Direct::Indices.

get_aliases()

    $response = $store->get_aliases(@args);

Retrieves the aliases for the specified indices, passing @args to "get_aliases()" in Search::Elasticsearch::Client::Direct::Indices.

put_aliases()

    $response = $store->put_aliases(@args);

Updates the aliases for the specified indices, passing @args to "update_aliases()" in Search::Elasticsearch::Client::Direct::Indices.

get_mapping()

    $response = $store->get_mapping(@args);

Retrieves the mappings for the specified index, passing @args to "get_mapping()" in Search::Elasticsearch::Client::Direct::Indices.

put_mapping()

    $response = $store->put_mapping(@args);

Updates the mappings for the specified index, passing @args to "put_mapping()" in Search::Elasticsearch::Client::Direct::Indices.

delete_mapping()

    $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.

reindex()

    $response = $store->reindex(@args);

Passes the @args to "reindex()" in Search::Elasticsearch::Bulk.

bootstrap_uniques()

    $response = $store->bootstrap_uniques(@args);

Creates the index which will store unique constraints, unless it already exists.

create_unique_keys()

    $response = $store->create_unique_keys(@args);

Inserts the documents representing unique constraints, and throws an error if they already exist.

delete_unique_keys()

    $response = $store->delete_unique_keys(@args);

Deletes the documents representing the specified unique constraints.

AUTHOR

Clinton Gormley <drtech@cpan.org>

COPYRIGHT AND LICENSE

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.