It's relatively easy to write the result directly in an ES database.
You need the elasticsearch package. Then:
- import it
- connect
- delete the index (if already exists)
- create the mapping
- send the data
import elasticsearch from 'elasticsearch'
const client = new elasticsearch.Client({
host: 'https://user:password@elastic.tld.com:443',
apiVersion: 'master',
maxSockets: 100,
requestTimeout: 1800000
})
yield client.indices.create({ index: 'github-stats' })
yield client.indices.putMapping({
index: 'github-stats',
type: 'event',
body: { ... }
})
...
client.index({
index: 'github-stats',
type: 'event',
body: { ... }
}, function (error, response) {
if (error) {
console.log(error)
}
}
})
...
It's relatively easy to write the result directly in an ES database.
You need the elasticsearch package. Then: