Error: text search not enabled:- in mongodb

不想你离开。 提交于 2019-12-05 09:25:26

MongoDB Text search is still an experimental feature. That's why it is disabled by default and must be enabled manually. You can do so by either starting mongod with the command line parameter --setParameter textSearchEnabled=true or adding the line textSearchEnabled=true to the file mongodb.conf.

Please note that as an experimental feature, text search should not be used in a production environment yet.

UPDATE

As of version 2.6 of mongoDB text search feature has production-quality and is enabled automatically.

In MongoDB 2.4 - to enable the experimental text search, use

setParameter=textSearchEnabled=true

The following line didn't work for me in the mongodb.conf file.

textSearchEnabled=true

EDIT In MongoDB 2.6 + it is enabled by default. You just need to set up your text indexes.

You have to specify this startup parameter (mentioned in above answers) when you start mongo. So if you start manually, then use:

mongod --setParameter textSearchEnabled=true 

Otherwise, if mongo is deamonized, put it into deamon script. Something like this:

start()
{
  echo -n $"Starting mongod: "
  daemon --user "$MONGO_USER" $NUMACTL $mongod --setParameter textSearchEnabled=true $OPTIONS

Then you create text index and check it's existence:

db.mycoll.createIndex( { someFieldName: "text" } );
db.mycoll.getIndexes()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!