'node.js elasticsearch self signed certificate in certificate chain
I've been trying to learn elasticsearch and decided to try to connect it with node.js. I have a elasticsearch running + a index I created named test-idx. I'm following the documentation of elasticsearch to connect and create a document however when I run my code I get 'ConnectionError: self signed certificate in certificate chain' followed by a huge meta object.
const client = new elasticsearch.Client({
node: 'https://localhost:9200',
auth: {
username: 'elastic',
password: '123456'
}
})
client.index({
index: 'test-idx',
document: {
field: 'test123'
}
})
I tried adding when creating the instance of the Client but it didn't seem to help
tls: {
rejectUnauthorized: false
}
Solution 1:[1]
I'm my case it's Working. I'm using node with nest js
tls: { rejectUnauthorized: false }
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Rahul Kumar |