How did you build the index (via Data Explorer, mongosh, driver?)
Is there any array fields in the collection you are indexing that are also included in the compound text index?
It’s possible you may have hit one of the following Text Index Restrictions. Look forward to hearing from you.
In saying so, the lack of error details does appear odd. I’ll run some tests on my end to see if I can hit the same error based on the restrictions via Data Explorer.
Interesting - The index name and details in your initial post seem to indicate this isn’t the same index (looks to be a compound index with tenanId, language, etc. Unless you have changed the name of it to include those?):
Can you run the following on the same collection and advise the output? db.collection.getIndexes() replacing collection with the collection name where the error is occuring. Also, when you state the trigger for the error, are you running that command via mongosh?
Also, I assume "collection" in the above has been redacted for the purposes of this post but just wanted to verify? It may not be the name field too. As advised in my previous response, the index in your screenshot shows that the index is a compound index which has more than just name field specified.
the compound is what I need. But I did many tries to isolate the issue.
And I can say that the simple
createIndex({ name: 'text'})
triggers the “unknown error”.
I have many indexes on that collection (18),
But again I have a replica locally with Docker (not with the same data but the same indexes etc.) and no problem.
It seems to be an issue on Atlas only.
Also in my screenshot, it’s visible that Atlas is trying to create the Index then it fails and disappears,
I hope it helps
EDIT: yes I staged I correctly replaced the collection name in my query I also replace the type “array” by type “string” to make sure of the validity of that query.
@Sebastien_Morel - Thanks for providing those details. There’s a few things I need to clarify below.
Please share the actual index you are trying to create.
Are you doing this from Atlas UI or from mongosh? Can you please send a screenshot of this creating the error? It would be good to see where you are getting this error itself. If it’s from the Project Activity feed, please provide a screenshot of that where the non-compound text index you specified - I imagine if {name: 'text'} is causing the error, the project acitivity feed should show something like:
Index build failed, Error provided: Unknown error
<>
Index Name: name_text /// <-- as opposed to the compound index name in your initial screenshot
Database: db
Collection: collection
Index Build Type: Background
The query you provided before seems to be checking for the name if it’s an array type. Can you advise what you tried here to check the validity? I think it would be better to try troubleshoot this with the full compound array index as opposed to the standard text index as that is what you would be creating in the end either way. The error which I received on my end was from another field (not name) which was an index. The query you provided previously was only searching on the name field. It would be better to get an understanding of what other fields are inside the collection since it may be hitting a text index restriction.
Lastly, please provide the output from db.collection.getIndexes() as well.
Please redact all sensitive and personal information before posting.
It returned the document since name field exists and it’s of type string. However, we can see that field c is the array.
If you know a field is an array (possibly relating to the index you’re trying to create), you can try with those fields instead. For example, for checking the field c:
Can you also check with anyone else with access to the Atlas project if they attempted to create the compound index in the past? It could possibly be that they have done it initially and is creating the error. Maybe not but it would be good to check.
Creating the index with language_override: 'nameIdxLanguage' even though that field does not exist fixed our issue and the index was successfully create