How to drop (delete, remove) a Mongo Atlas full-text search index on a collection?

How to drop (delete, remove) a Mongo Atlas full-text search index on a collection?

Thanks

Please check this

https://docs.atlas.mongodb.com/data-explorer/indexes

From command line
db.collection.getIndexes()
Identify your index name
Then
db.collection.dropIndex(“index_name”)

1 Like

That doesn’t work for Mongo Atlas full-text search indexes. Just regular indexes and text indexes.

All I get is…
[ { “v” : 2, “key” : { “_id” : 1 }, “name” : “id” } ]

So I am in a state where I have no idea where these indexes are, how to list them, nor how to drop them.

So you are able to create FTS index but cannot drop?
How did you create? Was it dynamic (default) or static
From where you got above details
What is your cluster type M0,M10…etc
You should be having edit index button

I created the FTS index in the UI.
There is apparently no way to create it through an api.
I did find the delete button in the UI.
There is no programmatic way to list or manage these FTS indexes, or know where they are; nor is there a list in the UI, so I had to click through all my collections to see which ones had an FTS index, then take notes in a separate file so I can keep track of what indexes are where since there is no apparent way in the Atlas UI to do that.

I think you have to use API http get method to get those details

https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all
https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-one

Hi @Melody_Maker,

As @Ramachandra_Tummala noted there are Atlas Search API methods that allow you to get details for (and manipulate) Atlas Search indexes. The API includes methods to Create an Atlas Search Index and Delete an Atlas Search Index.

You can also perform the same actions through the Atlas Search UI. See Delete an Atlas Search Index for the specific steps.

It sounds like the UI could be more intuitive. If you have suggestions for improvement, please create a topic on the MongoDB Feedback Engine and comment here with the link so others can watch & upvote.

A related feedback idea that you may be interested in is: Allow managing Atlas Search index via drivers.

Regards,
Stennie

1 Like

Thanks for the help guys.
I got it running in node.js
Here’s the code if anyone’s interested:
(refactored this way because I have the two funcs in separate files for reuse)

import DigestFetch from "digest-fetch";

/**
@func
do an ajax fetch using Digest Authentication

@deps
npm i digest-fetch crypto-js node-fetch

@param {string} publicKey
@param {string} privateKey
@param {string} url
@return {Promise<object[]>}
*/
const fetchDigest = async (publicKey, privateKey, url) => {
  const client = new DigestFetch(publicKey, privateKey, {});
  const res = await client.fetch(url, {});
  return await res.json();
};



/**
@func
make a request to the Mongo API using Digest Authentication

@param {string} url
@return {Promise<object[]>}
*/
const mongoApiRequest = async urlSegment => {
  const urlbase = "https://cloud.mongodb.com/api/atlas/v1.0/"; 
  return await fetchDigest(
    process.env.mongoProgrammaticApiKey_public,
    process.env.mongoProgrammaticApiKey_private,
    urlbase + urlSegment);
};


 //@test
 // get the Mongodb full-text index info for a particular collection
 logPromise(fetchFtsIndexInfo(
   `groups/${groupid}/clusters/${clusterid}/fts/indexes/${dbName}/${collName}?pretty=true`));