0.1.8 • Published 11 years ago

resourceful-couchelastic v0.1.8

Weekly downloads
83
License
-
Repository
github
Last release
11 years ago

resourceful-couchelastic

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.

Configuration

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;

	resourceful.use('couchelastic',{
		database:'couchelastic-sync-test'
	});

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.

Define a resource

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

Security

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

	var Employee = resourceful.define('Employee', function(){
		this.string('name');
		this.number('salary',{searchable:false});
	});

TODO - maybe just pass through mapping options transparently for flexibility

Searching

Assuming you've defined a Creature as per the Resourceful docs you should be able to search your database in free text like this.

	Creature.search("fur",function(err,creatures){
		// creatures is an array of Creature objects that match the search
	});

You can also search using the Elasticsearch query DSL

	Creature.search({
		term:{
			legs:4,
			eats:"wasps"
		}
	},function(err,creatures){
		// creatures is an array of Creature objects that match the search
	});

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

Installation

	npm install resourceful-couchelastic`

Tests

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

  $ npm test

Author: Richard Marr

License: Apache 2.0

0.1.8

11 years ago

0.1.7

11 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.0.13

12 years ago

0.0.12

12 years ago

0.0.11

12 years ago

0.0.10

12 years ago

0.0.9

12 years ago

0.0.8

12 years ago

0.0.7

12 years ago

0.0.6

12 years ago

0.0.5

12 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago