How to set mapping before indexing records?

Then you need to delete it, you cannot update an existing mapping like that.