Estimate creating index on cosmos DB - mongo

Migrate mongodb 1 Reputation point
2020-08-20T07:23:46.87+00:00

Hi, I migrated database from mongo-db into cosmos db.
I followed below url
https://datamigration.microsoft.com/scenario/mongo-to-cosmos?step=1

After migrating data into cosmos db, I created index on collection by query:
db.getCollection(" collection_name").createIndex({ "modified_at": 1 })
returned:
{
"createdCollectionAutomatically": false,
"numIndexesBefore": 2,
"numIndexesAfter": 3,
"ok": 1
}

my collection have 9GB data size and around 8M documents.

After create index, I check with below query:
db.collection_name.find({ "modified_at" : {$gte: "2020-08-18"} })
This query returned time-out, maybe index didn't create completely.

I checked index-progress follow url:
https://video2.skills-academy.com/en-us/azure/cosmos-db/mongodb-indexing#track-index-progress
Using: db.currentOp({"command.createIndexes": { $exists : true } })
It returned:
{
"inprog" : [],
"ok" : 1
}

It means that index created completely? I don't think so because my query still run timeout.

After 3 hours, I run find query again: db.collection_name.find({ "modified_at" : {$gte: "2020-08-18"} }), at that time, query return very fast. Maybe at that time, index created completely.

How to estimate time creating index for collection, could you help me estimate maximum time creating index finish?
Currently, I set 150k RU per second. If I want to speed up of create index, what should I do?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,632 questions
{count} votes

Your answer

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