How to get the execution time of ES Sql query?

Hi.. Can anyone please tell me how to get the execution time ( "took") for this below query. 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);
        }
    });
}

You have to extract Took-nanos from the header of the HTTP response.

Thanks a lot Matriv :+1:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.