Cannot create Search Indexes with spaces in name using API, only in UI

We have a project that is in production, and are going to be adding more sites that use the same front end code base. For the first site we built a search index in Atlas using the UI that has a space in the name - e.g. “content search”. Part of the process of rolling out other sites is that we duplicate the mongo set up - Collections/functions/App Services/Resolvers/Search etc using Atlas API, App Services API and some direct .Net driver methods, but it is not possible to create a search index with a name in using the API, only via the UI.

Does anyone know why this is? Is there any way to get round this, or escape the space in some way?

Hi @James_Houston - Welcome to the community.

Just to clarify, could you confirm the following:

  1. When creating the search index via the Atlas UI - You’re able to create it successfully when you set the index name to contain spaces (like the example “content search”).
  2. When creating the search index via the Atlas API, supplying an index name containing a space causes issues

Is the above two statements correct? If so, regarding 2., what is the error you are receiving or could you describe what happens when you attempt to create the index with a space in it’s name via the API?

Regards,
Jason

1 Like

Hi There.
Hi There,

We resolved this by switching to search indices without spaces in their names. I dont remember the error - it was a long time ago now. One is now unable to make a search index name with a space in it in the UI as well - it shows an invalid field notification - you must have pulled that one at some point.