elasticsearch cat indices nodejs API json output elasticsearch cat indices nodejs API json output elasticsearch elasticsearch

elasticsearch cat indices nodejs API json output


The cat APIs are meant to be consumed by humans (hence not JSON).

If you want to get JSON data, you can use the indices.stats call (which hits the /_stats API endpoint).

client.indices.stats({   index: "_all",   level: "indices"}, function(err, res) {   // res contains JSON data about indices stats});

UPDATE:

Actually, the cat APIs also return JSON data, if you specify the parameter format: json in the request:

client.cat.indices({"format": "json"}, function(err, res) {    ...});