I tried it in 2 ways. firstly, I used it in the bulk.push() API where I load my json data and assign it to a variable. Secondly, I created a new file called preprocess.js in client.indices.create() and used it there along with the mapping (code I used in 2nd method is written below and is taken from a blog). Both the ways are not working and I don't know what I am missing.
'type': 'long', // type is a required attribute if index is specified