Abhilash Chelankara
Abhilash Chelankara

Reputation: 406

Set text search feature in mongodb

I have a production server hosted in mongohq with version 2.4.6. I need to add text index to one of the collections. I tried using the below command from mongo client connecting to my remote server:

db.logs.ensureIndex({title: 'text', description: 'text'})

By default, we cannot add index to production server, since it is restricted by mongohq. But I need to restart the server like below to enable text search:

mongod --setParameter textSearchEnabled=true

But this is possible only for local servers.

Does anyone know how to get this done on remote mongohq server?

Upvotes: 0

Views: 414

Answers (1)

Saheed Hussain
Saheed Hussain

Reputation: 1178

Try this in mongoclient "mongo", it should work for you

db.adminCommand( { setParameter : 1, textSearchEnabled : true } )

also check out these links, they may be helpful

http://docs.mongodb.org/v2.4/tutorial/enable-text-search/

mongodb: enable textSearch

Upvotes: 1

Related Questions