Hybrid Couchdb/Elasticsearch engine for Resourceful


The goal of CouchElastic is to provide seamless full-text and parametric search to Node.js apps, accomplished via Flatiron's Resourceful ODM layer and the awesome power of CouchDB and Elasticsearch.

Start up an empty instance of CouchDB and an empty instance of Elasticsearch, then do this:

    var resourceful = require('resourceful'),
        Couchelastic = require('resourceful-couchelastic').Couchelastic;

From this point onwards each Resource that you define will have its data stored in your specified CouchDB cluster and have an Elasticsearch indexing river configured to index the data for searching.

Assuming you're already defining resources with Resourceful nothing more is required, but there are some additional optional you might want to use.

If some of your Resource data is sensitive you might want to block it from being indexed

    var Employee = resourceful.define('Employee', function(){

TODO - maybe just pass through mapping options transparently for flexibility

Assuming you've defined a Creature as per the Resourceful docs you should be able to search your database in free text like this."fur",function(err,creatures){
        // creatures is an array of Creature objects that match the search 

You can also search using the Elasticsearch query DSL{
        // creatures is an array of Creature objects that match the search 

TODO - clean up the object search API and allow faceting etc.

    npm install resourceful-couchelastic`

All tests are written with vows and should be run with npm:

  $ npm test