[DOCS-3412] Explain how to drop a Full Text index Created: 16/May/14  Updated: 22/May/14  Resolved: 22/May/14

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: mongodb-2.6, mongodb-3.0
Fix Version/s: v1.3.5

Type: Improvement Priority: Critical - P2
Reporter: Tugdual Grall Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 0
Labels: sprint-slipstream
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 9 years, 38 weeks, 6 days ago

 Description   

TL;TR:
We need to clarify how to delete Full Text indexes, and user must use the proper key:
db.collection.dropIndex(

{ "_fts" : "text", "_ftsx" : 1 }

)

Details

The db.collection.dropIndex(<idx>) use the key of the index as parameter. For most of the index the "key" is the value you pass when you create the index.

This is not the case for a Full Text index.

Let's take an example:

— standard index -----
db.collection.ensureIndex(

{name : 1}

);

user can simply do:
db.collection.dropIndex(

{name : 1}

);
>> OK

– full text search index –
db.collection.ensureIndex(

{ description : "text"}

);

if the user execute :
db.collection.dropIndex(

{ description : "text"}

);
the following error is raised:
"can't find index with key:

{ description: \"text\" }

"

This is because the key is not

{ description : "text"}

as you can look using the command:
db.collection.getIndexes( );

The key of the index is:

{ "_fts" : "text", "_ftsx" : 1 }

The proper command is:
db.collection.dropIndex(

{ "_fts" : "text", "_ftsx" : 1 }

)



 Comments   
Comment by Githook User [ 22/May/14 ]

Author:

{u'username': u'kay-kim', u'name': u'kay', u'email': u'kay.kim@10gen.com'}

Message: DOCS-3412 drop text index
Branch: master
https://github.com/mongodb/docs/commit/680ad4206ef037af4ffc63851775ff406c72aac9

Generated at Thu Feb 08 07:45:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.