How can I generate records for elasticsearch? I would like to generate at least 1 million records to test the memory size.
const now = new Date()
const startOfDay = new Date(now.getFullYear(), now.getMonth(), Math.random(now.getDate()))
const timestamp = startOfDay / 1000
const randomRecords = Array(10000000).fill(timestamp)
randomRecords.forEach((record, i) => {
clientTest.index({
index: 'test',
type: 'test',
id: '1',
body: {
[record]: `${record}${i}`,
},
}).then(function (resp) {
logger.silly('Pushing of data completed', resp)
return resp
}, function (err) {
console.trace(err.message)
})
})