NAME

Nile::Plugin::Elasticsearch - Elasticsearch client plugin for the Nile framework.

SYNOPSIS

    my $client = $app->plugin->elasticsearch;
    
    $app->dump($client->nodes->info);
    
    $app->dump($client->nodes->stats);

    $client->index(
        index   => 'my_index',
        type    => 'blog_post',
        id      => 123,
        body    => {
            title   => "Elasticsearch clients",
            content => "Interesting content...",
            date    => "2013-09-23"
        }
    );

    my $doc = $client->get(
            index   => 'my_index',
            type    => 'blog_post',
            id      => 123,
			ignore => [404,409],
    );

    $app->dump($doc);

    my $results = $client->search(
        index   => 'my_index',
        body    => {
            query => {
                match => {
                    title => "elasticsearch"
                }
            }
        }
    );

    $app->dump($results);

DESCRIPTION

Nile::Plugin::Elasticsearch - Elasticsearch client plugin for the Nile framework.

This is a client for Elasticsearch using Search::Elasticsearch module. All methods of the Search::Elasticsearch module are supported.

Plugin settings in th config file under plugin section.

<plugin>

    <elasticsearch>
        <nodes>localhost:9200</nodes>
    </elasticsearch>

</plugin>

client()

# connect to Elasticsearch server
my $es = $app->plugin->elasticsearch;
my $client = $es->client;

Returns the Search::Elasticsearch client object instance used. All Search::Elasticsearch methods can be accessed through this method. The default client is Search::Elasticsearch::Client::Direct.

Bugs

This project is available on github at https://github.com/mewsoft/Nile.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Nile.

SOURCE

Source repository is at https://github.com/mewsoft/Nile.

SEE ALSO

See Nile for details about the complete framework.

AUTHOR

Ahmed Amin Elsheshtawy, احمد امين الششتاوى <mewsoft@cpan.org> Website: http://www.mewsoft.com

COPYRIGHT AND LICENSE

Copyright (C) 2014-2015 by Dr. Ahmed Amin Elsheshtawy احمد امين الششتاوى mewsoft@cpan.org, support@mewsoft.com, https://github.com/mewsoft/Nile, http://www.mewsoft.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.