Basic Auth

edit

Basic authentication credentials can be configured on a per-host basis using URL notation, or at the auth: property of a host config object.

Credentials directly in the host url:

var client = new elasticsearch.Client({
  host: 'https://user:password@my-site.com:9200'
})

Credentials as a property of the host config:

var client = new elasticsearch.Client({
  host: [
    {
      host: 'es1.internal.org',
      auth: 'user:password',
      protocol: 'https',
      port: 9200
    }
  ]
});