Full Text Search in MongoDB/Node.js-mongoose-text-search
The mongoose-text-search
plugin is working for me. I had to set textSearchEnabled
to true
. I didn't try it as a parameter on startup, but this worked once my mongod instance was already running:
use admindb.runCommand({'setParameter':1,"textSearchEnabled":true})use <my db><my db>.<my colleciton>.ensureIndex({"$**":"text"}) //Beware! "$**" indexes the entire document
Also, you really might want to consider using Elasticsearch instead of Mongo's FTS. Mongo's FTS solution is not production ready (see the warning). I also have limited experience with Elasticsearch but found it very impressive.
If you do choose to go the Elasticsearch route and still want to use Mongo, there are some decent options:
- A river, which requires turning on replica setso the river can monitor the oplog (see the wiki)
- Mongoosastic, which plugs in nicely to Mongoose for querying and keeps ES in sync with Mongo by writing to both Mongo and ES.
UpdateSince 2.6 Mongo has text search enabled by default.