Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
elasticsearch js: auth having no effect

I have an app that connects to Elasticsearch. It uses standardized js approach to connecting to our enterprise elasticsearch.

const client = new Client({
    node: 'https://my-domain.com',
    auth: {
        username: 'user',
        password: 'pswd'
    },
    tls: {
        rejectUnauthorized: false,
    }
});

I have two problems. First is, that when I delete the auth (which is required), it has no effect.

The second one is that I'm not getting any results neither way (with or without auth). I need to search all indicies with a special pattern 'az*'. In normal elasticsearch, it is possible, hovewer I can't figure it out how to do it programatically.

Here is mine current code:

const printBody = async () => {
    const body = await client.search({
        index: "az*", //not sure whether this line is ok
        query: {
            match: {
                object: "*TEST*"
            }
        }

    });
    console.log(JSON.stringify(body));
}

This code always prints "". Any ideas how to get a result of a query search?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!