mongoose-elastic
v0.0.8
Published
Do stuff with elastic and mongoose
Downloads
8
Readme
Mongoose-elastic
Do stuff with elastic and mongoose
Version
0.3
Tech
- Mongoose
Directory Structure
|---mongoose-elastic
|-lib
|-test
Install
npm install mongoose-elastic --save
Setup
Add a mapping and prefix.
activitySchema.plugin(elastic, { prefix: 'dev',
mapping: {
message: String,
event: {
title: String
}
}
})
syncAll
Sync things.
Activity.syncAll(function(err) {
if (err) {
console.log(err);
}
console.log('done!');
})
sync
activity.sync(function() {})
search
Global
elastic.search.config({ prefix: 'stage' });
elastic.search({ collections: ['activities'] }, function(err, results) {
if (err) {
console.log(err);
}
console.log(results);
})
Just a collection
Activity.search({ prefix: 'dev' }, function(err, results) {
if (err) {
console.log(err);
}
console.log(results);
})
Tests
make test