When a new Sync Gateway database is created against collections that weren't previously mobile-enabled, Sync Gateway needs to create indexes for each of these collections. Index creation is a relatively slow process (https://issues.couchbase.com/browse/MB-55993).
Typically the first operations a customer will be performing after creating a database are config operations like creating sync functions. If possible, it would be preferable to bring up the REST API without waiting on index creation. Operations without index dependencies would be allowed to proceed, while those with an index dependency should return an appropriate error until the indexes are ready (probably 503 with an appropriate message).