2

I need to list all indices in my node.js app, using elasticsearch.js node module. What I have is:

var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
  host: 'localhost:9200',
  log: 'trace'
});

  client.indices.get({

  })

The error I get is:

(node:72002) UnhandledPromiseRejectionWarning: TypeError: Unable to build a path with those params. Supply at least index

What is the proper syntax for client.indices.get, which would list all available indices?

1 Answer 1

3

Try like this

const indices = await client.cat.indices({format: 'json'})
console.log('indices:', indices)

or else

client.cat.indices("b",function(r,q){
  console.log(r,q);
}) }]);

Hope it helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.