1
0

index.asciidoc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. = Elasticsearch.pm
  2. == Overview
  3. Elasticsearch.pm is the official Perl API for Elasticsearch. The full
  4. documentation is available on https://metacpan.org/module/Elasticsearch.
  5. It can be installed with:
  6. [source,sh]
  7. ------------------------------------
  8. cpanm Elasticsearch
  9. ------------------------------------
  10. === Features
  11. This client provides:
  12. * Full support for all Elasticsearch APIs
  13. * HTTP backend (currently synchronous only - Any::Event support will be added later)
  14. * Robust networking support which handles load balancing, failure detection and failover
  15. * Good defaults
  16. * Helper utilities for more complex operations, such as bulk indexing, scrolled searches and reindexing.
  17. * Logging support via Log::Any
  18. * Compatibility with the official clients for Python, Ruby, PHP and Javascript
  19. * Easy extensibility
  20. == Synopsis
  21. [source,perl]
  22. ------------------------------------
  23. use Elasticsearch;
  24. # Connect to localhost:9200:
  25. my $e = Elasticsearch->new();
  26. # Round-robin between two nodes:
  27. my $e = Elasticsearch->new(
  28. nodes => [
  29. 'search1:9200',
  30. 'search2:9200'
  31. ]
  32. );
  33. # Connect to cluster at search1:9200, sniff all nodes and round-robin between them:
  34. my $e = Elasticsearch->new(
  35. nodes => 'search1:9200',
  36. cxn_pool => 'Sniff'
  37. );
  38. # Index a document:
  39. $e->index(
  40. index => 'my_app',
  41. type => 'blog_post',
  42. id => 1,
  43. body => {
  44. title => 'Elasticsearch clients',
  45. content => 'Interesting content...',
  46. date => '2013-09-24'
  47. }
  48. );
  49. # Get the document:
  50. my $doc = $e->get(
  51. index => 'my_app',
  52. type => 'blog_post',
  53. id => 1
  54. );
  55. # Search:
  56. my $results = $e->search(
  57. index => 'my_app',
  58. body => {
  59. query => {
  60. match => { title => 'elasticsearch' }
  61. }
  62. }
  63. );
  64. ------------------------------------
  65. == Reporting issues
  66. The GitHub repository is http://github.com/elasticsearch/elasticsearch-perl
  67. and any issues can be reported on the issues list at
  68. http://github.com/elasticsearch/elasticsearch-perl/issues.
  69. == Contributing
  70. Open source contributions are welcome. Please read our
  71. https://github.com/elasticsearch/elasticsearch-perl/blob/master/CONTRIBUTING.asciidoc[guide to contributing].
  72. == Copyright and License
  73. This software is Copyright (c) 2013 by Elasticsearch BV.
  74. This is free software, licensed under:
  75. https://github.com/elasticsearch/elasticsearch-perl/blob/master/LICENSE.txt[The Apache License Version 2.0].