Hi...
Can someone help to format the output in CSV for this Node JS code. I am using Elastic 7.10.2. I have tried change the path like /_sql?format=csv its not working. But the same path in Kibana Dev Terminal, I am able to get the csv output. Thanks in advance...
async function mysqlfunc(req, res) {
client.transport.request({
method: "POST",
path: "/_sql",
body: {
query: "SELECT field1, filed2 FROM myindex limit 10"
}
}, function(error, response) {
if (error) {
console.error('Something does not compute : ' + error);
} else {
console.log("Output : " + response.rows);
res.send(response.rows);
}
});
}