Create atlas search index with same index name

I’m planning to create an Atlas Search Index via Terraform or Atlas APIs. Both of these methods accept name as a parameter. Now, if I do this CREATE operation again with the same name but with a different property, say analyzer, will it update the existing index or throw an error?

Why not use Update?

Yes but I’m trying to automate managing indexes and using UPDATE would require me to maintain the indexId. I still didn’t the answer for what happens when CREATE is called for second time

I haven’t personally tried it to know but my guess is it will fail and say “index already exists with this name” or something to that degree

Hi @Shabir_Hamid, I have implemented some automated search index creation and can confirm that the API throws an error if you try to create an index with the same name.

In my case I implemented logic to request the existing search indexes on the collection and then check to see if any of them have the same name. If not then the request to create the index is created.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.