Reconciled API change in the indexDocument method, added index creation and mapping from the schema in the createIndex method.