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?