diff --git a/docs/index.asciidoc b/docs/index.asciidoc index d009b3d0..497ecc8c 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -1,124 +1,13 @@ = Elasticsearch.pm -== Overview +:doctype: book -Search::Elasticsearch is the official Perl API for Elasticsearch. The full -documentation is available on https://metacpan.org/module/Search::Elasticsearch. +include::{asciidoc-dir}/../../shared/attributes.asciidoc[] -It can be installed with: +include::overview.asciidoc[] -[source,sh] ------------------------------------- -cpanm Search::Elasticsearch ------------------------------------- +include::installation.asciidoc[] -=== Features - -This client provides: - -* Full support for all Elasticsearch APIs - -* HTTP backend (blocking and asynchronous with https://metacpan.org/module/Search::Elasticsearch::Async) - -* Robust networking support which handles load balancing, failure detection and failover - -* Good defaults - -* Helper utilities for more complex operations, such as bulk indexing, scrolled searches and reindexing. - -* Logging support via Log::Any - -* Compatibility with the official clients for Python, Ruby, PHP and JavaScript - -* Easy extensibility - -== Synopsis - -[source,perl] ------------------------------------- -use Search::Elasticsearch; - -# Connect to localhost:9200: -my $e = Search::Elasticsearch->new(); - -# Round-robin between two nodes: -my $e = Search::Elasticsearch->new( - nodes => [ - 'search1:9200', - 'search2:9200' - ] -); - -# Connect to cluster at search1:9200, sniff all nodes and round-robin between them: -my $e = Search::Elasticsearch->new( - nodes => 'search1:9200', - cxn_pool => 'Sniff' -); - -# Index a document: -$e->index( - index => 'my_app', - type => 'blog_post', - id => 1, - body => { - title => 'Elasticsearch clients', - content => 'Interesting content...', - date => '2014-09-24' - } -); - -# Get the document: -my $doc = $e->get( - index => 'my_app', - type => 'blog_post', - id => 1 -); - -# Search: -my $results = $e->search( - index => 'my_app', - body => { - query => { - match => { title => 'elasticsearch' } - } - } -); ------------------------------------- - -[[v0_90]] -== Elasticsearch 0.90.* and earlier - -The current version of the client supports the Elasticsearch 1.0 branch by -default, which is not backwards compatible with the 0.90 branch. - -If you need to talk to a version of Elasticsearch before 1.0.0, -please use `Search::Elasticsearch::Client::0_90::Direct` as follows: - -[source,perl] ------------------------------------- - $es = Search::Elasticsearch->new( - client => '0_90::Direct' - ); ------------------------------------- - - -== Reporting issues - -The GitHub repository is https://github.com/elastic/elasticsearch-perl -and any issues can be reported on the issues list at -https://github.com/elastic/elasticsearch-perl/issues. - -== Contributing - -Open source contributions are welcome. Please read our -https://github.com/elastic/elasticsearch-perl/blob/master/CONTRIBUTING.asciidoc[guide to contributing]. - -== Copyright and License - -This software is Copyright (c) 2013-2018 by Elasticsearch BV. - -This is free software, licensed under: -https://github.com/elastic/elasticsearch-perl/blob/master/LICENSE.txt[The Apache License Version 2.0]. diff --git a/docs/installation.asciidoc b/docs/installation.asciidoc new file mode 100644 index 00000000..d220d9cf --- /dev/null +++ b/docs/installation.asciidoc @@ -0,0 +1,18 @@ +[[installation]] +== Installation + +You can install the latest stable release of the Perl Client by using the +following command: + +[source,sh] +------------------------------------ +cpanm Search::Elasticsearch +------------------------------------ + +To install a specific version, download the specific version artifact. For +example, to download elasticsearch-perl 6.81, use the following command: + +[source,sh] +------------------------------------ +cpanm EZIMUEL/Search-Elasticsearch-6.81.tar.gz +------------------------------------ \ No newline at end of file diff --git a/docs/overview.asciidoc b/docs/overview.asciidoc new file mode 100644 index 00000000..b615fbf6 --- /dev/null +++ b/docs/overview.asciidoc @@ -0,0 +1,119 @@ +== Overview + +Search::Elasticsearch is the official Perl API for {es}. You can find the full +documentation https://metacpan.org/module/Search::Elasticsearch[here]. + +The intention of this client is to provide unopinionated and robust support for +the full native {es} API. + +=== Features + +This client provides: + +* Full support for all {es} APIs. + +* HTTP backend (blocking and asynchronous with + https://metacpan.org/module/Search::Elasticsearch::Async). + +* Robust networking support which handles load balancing, failure detection and + failover. + +* Good defaults. + +* Helper utilities for more complex operations, such as bulk indexing, scrolled + searches and reindexing. + +* Logging support via Log::Any. + +* Compatibility with the official clients for Python, Ruby, PHP and JavaScript. + +* Easy extensibility. + + +=== Synopsis + +[source,perl] +------------------------------------ +use Search::Elasticsearch; + +# Connect to localhost:9200: +my $e = Search::Elasticsearch->new(); + +# Round-robin between two nodes: +my $e = Search::Elasticsearch->new( + nodes => [ + 'search1:9200', + 'search2:9200' + ] +); + +# Connect to cluster at search1:9200, sniff all nodes and round-robin between them: +my $e = Search::Elasticsearch->new( + nodes => 'search1:9200', + cxn_pool => 'Sniff' +); + +# Index a document: +$e->index( + index => 'my_app', + type => 'blog_post', + id => 1, + body => { + title => 'Elasticsearch clients', + content => 'Interesting content...', + date => '2014-09-24' + } +); + +# Get the document: +my $doc = $e->get( + index => 'my_app', + type => 'blog_post', + id => 1 +); + +# Search: +my $results = $e->search( + index => 'my_app', + body => { + query => { + match => { title => 'elasticsearch' } + } + } +); +------------------------------------ + +[[v0_90]] +=== Elasticsearch 0.90.* and earlier + +The current version of the client supports the Elasticsearch 1.0 branch by +default, which is not backwards compatible with the 0.90 branch. + +If you need to talk to a version of Elasticsearch before 1.0.0, +please use `Search::Elasticsearch::Client::0_90::Direct` as follows: + +[source,perl] +------------------------------------ + $es = Search::Elasticsearch->new( + client => '0_90::Direct' + ); +------------------------------------ + + +=== Reporting issues + +The GitHub repository is https://github.com/elastic/elasticsearch-perl and any +issues can be reported on the issues list at +https://github.com/elastic/elasticsearch-perl/issues. + +=== Contributing + +Open source contributions are welcome. Please read our +https://github.com/elastic/elasticsearch-perl/blob/master/CONTRIBUTING.asciidoc[guide to contributing]. + +=== Copyright and License + +This software is Copyright (c) 2013-2018 by Elasticsearch BV. + +This is free software, licensed under: +https://github.com/elastic/elasticsearch-perl/blob/master/LICENSE.txt[The Apache License Version 2.0].