Is there any way to use in elastic clients(node.js) without index parameter

I have an account that only accessible to an index.
So index name had to be written in node.url for avoiding security exception
but I got error code 400(bad Request) instead of security Exception,
because of missing index name in const body.

Is there any way to get search result without providing index name in
please refer my node.js codes as following

const { Client } = require('@elastic/elasticsearch');
const { URL } = require('url');

const client = new Client({
    node: {
        url: new URL(''), //without index name, I got a security exception 
        username: 'test',
        password: 'test',

async function run() {

  // Let's search!
    const { body } = await{
        //  index: '', //It's already written in node.URL
        type: '_docs', 
        body: { //to get all data

    console.log('The body content : ' + body.hits.hits);


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