WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
SSL configuration
editSSL configuration
editWithout any additional configuration you can specify https://
node urls, but the certificates used to sign these requests will not verified (rejectUnauthorized: false
). To turn on certificate verification you must specify an ssl
object either in the top level config or in each host config object and set rejectUnauthorized: true
. The ssl config object can contain many of the same configuration options that tls.connect() accepts.
const { Client } = require('@elastic/elasticsearch') const client = new Client({ node: 'http://username:password@localhost:9200', ssl: { ca: fs.readFileSync('./cacert.pem'), rejectUnauthorized: true } })