NAME

Elastic::Manual - What is Elastic::Model and how do I use it?

VERSION

version 0.51

WHAT IS ELASTIC::MODEL?

Elastic::Model is a framework to store your Moose objects, which uses Elasticsearch as a NoSQL document store and flexible search engine.

It is designed to make it easy to start using Elasticsearch with minimal extra code, but allows you full access to the rich feature set available in Elasticsearch as soon as you are ready to use it.

For a brief example of how Elastic::Model works, you should start by reading Elastic::Manual::Intro.

WHAT IS ELASTICSEARCH?

Elasticsearch is an open-source Lucene-based full-text search engine, and a NoSQL document store / database.

Schema-free and document oriented

Elasticsearch stores your objects as JSON documents. Most Perl objects can be mapped easily to their JSON equivalent.

It is schema free, in that you don't need to define your field/properties/attributes ahead of time; you can just toss it a JSON document and it'll try to autodetect data types and index your doc. That said, the power of full text search comes from the ability to configure your search to suit your data and requirements. Sophisticated options exist to give you complete control over how your data is indexed.

Real-time

Elasticsearch is a real-time data store (as soon as your document is indexed, it can be retrieved from any node in the cluster) and has near-real-time search. By default, docs become visible to search within 1 second of being indexed.

Distributed

Elasticsearch is built to scale out of the box. It is easy to start with a single node, and to add new nodes as required, giving you high availability and huge scale. A cluster can scale to hundreds of nodes and terrabytes of data. If a node goes down, the cluster will automatically redistribute and just keep on working.

TABLE OF CONTENTS

Elastic::Manual::Intro

Start by reading Elastic::Manual::Intro for a gentle introduction to Elastic::Model.

Elastic::Manual::Delta

Contains important information about changes to Elastic::Model and migration paths.

Elastic::Manual::Terminology

A brief definition of some of the terms used by Elasticsearch and Elastic::Model.

Elastic::Manual::NoSQL

Some things you need to think about when moving from a relational DB to a NoSQL document store like Elasticsearch.

Elastic::Manual::Attributes

Fine-tuning how the attributes in your Elastic::Doc classes are indexed.

Elastic::Manual::Attributes::Unique

Making attributes in your Elastic::Doc classes unique.

Elastic::Manual::Reindex

How to reindex your data when you make changes to your attributes.

Elastic::Manual::QueryDSL

Using the Elasticsearch Query DSL (and the ElasticSearch::SearchBuilder syntax) to query your documents efficiently.

Elastic::Manual::QueryDSL::Queries

Commonly used queries

Elastic::Manual::QueryDSL::Filters

Commonly used filters

Elastic::Manual::QueryDSL::Nested

Queries and filters for "nested" fields.

Elastic::Manual::Searching

Which search method to use with a View, and how to iterate through the results.

Elastic::Manual::Analysis

Controlling how your attributes are indexed so that they can be queried as you need.

Elastic::Manual::Scaling

How to use Elastic::Model to go from a small development environment to massive scale.

Elastic::Manual::Scoping

When and how to use Scopes, an optional in-memory cache (but required if you use weak refs).

BUGS

This is a new module, so there will probably be bugs, and the API may change in the future.

If you have any suggestions for improvements, or find any bugs, please report them to http://github.com/clintongormley/Elastic-Model/issues. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

TEST SUITE

The full test suite requires a live Elasticsearch cluster to run. CPAN testers doesn't support this. You can see full test results here: http://travis-ci.org/#!/clintongormley/Elastic-Model/builds.

To run the full test suite locally, run it as:

perl Makefile.PL
ES_HOME=/path/to/Elasticsearch make test

Or, if you are happy for any index starting with "myapp" to be deleted, you can start your Elasticsearch server and run it as:

perl Makefile.PL
ES='localhost:9200' make test

This is much faster as it doesn't have to restart the server multiple times, but you will lose any indices matching /^myapp.*/.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Elastic::Manual

You can also look for information at:

ACKNOWLEDGEMENTS

Thanks to Shay Banon, the Elasticsearch author, for producing an amazingly easy to use search engine, to PERLER for writing ElasticSearchX::Model, which was the original inspiration, to FLORA and MSTROUT for encouraging me to do better, and to DOY for guiding me through Moose internals.

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.