The cosmosSearch.query is not enabled for this cluster

Julius Dietmar 60 Reputation points
2026-07-22T01:10:45.98+00:00

I have a M30 DocumentDB cluster (which, according to the documentation here: https://devblogs.microsoft.com/cosmosdb/diskann-in-azure-cosmos-db-for-mongodb supports DiskANN vector search) and created successfully vector search indexes on my items collection. However, when I execute a search query, I receive this error:

The cosmosSearch.query is not enabled for this cluster

Index creation:

  "createIndexes": "items",
  "indexes": [
    {
      "name": "text_vector_index",
      "key": { "textEmbeddings": "cosmosSearch" }, // Path to your vector array field
      "cosmosSearchOptions": {
        "kind": "vector-diskann",               // Options: 'vector-hnsw', 'vector-ivf', or 'vector-diskann'
        "dimensions": 1536,                  // Vector dimensions (e.g., 1536 for OpenAI embeddings)
        "similarity": "COS",                 // Options: 'COS' (Cosine), 'L2' (Euclidean), 'IP' (Dot Product)
        "maxDegree": 64,
        "lBuild": 128
      }
    }
  ]
})

Query:

db.items.aggregate([ { $search: { cosmosSearch: { path: "textEmbeddings", query: [0.1, ... 0.2], k: 1 } } } ])

MongoServerError[CommandNotSupported]:

Do I have to enable it and if so, where? If not, why is it not enabled?

Azure DocumentDB
Azure DocumentDB

A scalable, fully managed NoSQL database for JSON documents with fast queries and automatic indexing


Answer accepted by question author
Allan Solomon Mejia 7,915 Reputation points
2026-07-22T01:38:50.48+00:00

Hello Julius,

M30 supports DiskANN, so you shouldn’t need to enable cosmosSearch manually. The index definition looks valid, but the query uses query; the current syntax expects the embedding under vector.

Try:

db.items.aggregate([
  {
     $search: {
      cosmosSearch: {
        path: "textEmbeddings",
        vector: [0.1, 0.2 /* full 1536-value vector */],
        k: 1,
        lSearch: 40
       }
     }
   }
])

Also confirm that the query contains exactly 1,536 numeric values, matching the index dimensions, and check the index status with db.items.getIndexes().

If the corrected query still returns “cosmosSearch query is not enabled for this cluster,” the feature may not have been provisioned correctly on that specific cluster. At that point, recreate the M30 cluster or open an Azure support request with the cluster resource ID and region, because this would be a service-side enablement issue rather than something exposed as a portal setting. Microsoft’s current documentation confirms DiskANN and cosmosSearch support on M30 and higher tiers.

Please "Accept the answer" if this information helped you. This will help us and others in the community as well.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.