I have a MongoDB with around 80k documents, each one is an entry with title
, body_text
, etc. I want to do FullTextSearch
, for which reason I created a text index with the command:
db.getCollection('arquivo_entry').createIndex({title:"text",body_text:"text"},{ weights:{title:2,body_text:1}},{default_language:"portuguese"})
The index building failed because of it ran out of memory and it killed the job that had mongodb running. This is in the log:
2018-03-22T14:58:12.017+0000 I - [initandlisten] Index Build: 2500/86187 2%
2018-03-22T14:58:15.028+0000 I - [initandlisten] Index Build: 6900/86187 8%
2018-03-22T14:58:18.012+0000 I - [initandlisten] Index Build: 12400/86187 14%
2018-03-22T14:58:21.065+0000 I - [initandlisten] Index Build: 17300/86187 20%
2018-03-22T14:58:24.047+0000 I - [initandlisten] Index Build: 22500/86187 26%
2018-03-22T14:58:27.043+0000 I - [initandlisten] Index Build: 28600/86187 33%
2018-03-22T14:58:30.013+0000 I - [initandlisten] Index Build: 34000/86187 39%
2018-03-22T14:58:32.478+0000 F - [initandlisten] out of memory.
And the problem now is that I'm not able to delete the index and each time I try to launch the database it starts to rebuild the index automatically. Additionally, I'm not able to start a mongodb shell. It gives me the following error:
MongoDB shell version v3.6.3 connecting to: mongodb://127.0.0.1:27017
2018-03-22T15:08:38.688+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2018-03-22T15:08:38.688+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13 @(connect):1:6
exception: connect failed