Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-3412

Explain how to drop a Full Text index

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: mongodb-2.6, mongodb-3.0
    • Fix Version/s: v1.3.5
    • Component/s: manual
    • Last comment by Customer:
      true
    • Actual Time:
      4

      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 }

      )

        Attachments

          Activity

            People

            Assignee:
            kay.kim Kay Kim (Inactive)
            Reporter:
            tugdual.grall Tugdual Grall
            Participants:
            Last commenter:
            Jonathan Dahl Jonathan Dahl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since reply:
              7 years, 23 weeks, 6 days ago
              Date of 1st Reply: