Can someone tell me how to create indexes in the game data through the cloud code?
You can't create Game Data indexes in cloud code you will have to create them in the portal and configure them there. You shouldn't need to create an index in cloud code. Indexes are meant to be used as a field that you query your database to retrieve data back based on the indexed query. These should be set up before you try and receive data in cloud code.