[Backport 7.x] ApiKey should take precedence over basic auth (#1117)

* ApiKey should take precedence over basic auth

* Updated docs

* Updated test

Co-authored-by: Tomas Della Vedova <delvedor@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2020-03-13 13:41:57 +01:00
committed by GitHub
parent ca23e0b23a
commit a9a905409e
4 changed files with 103 additions and 7 deletions

View File

@ -41,6 +41,8 @@ const client = new Client({
You can provide your credentials by passing the `username` and `password`
parameters via the `auth` option.
NOTE: If you provide both basic authentication credentials and the Api Key configuration, the Api Key will take precedence.
[source,js]
----
const { Client } = require('@elastic/elasticsearch')
@ -74,6 +76,8 @@ authentication by passing the `apiKey` parameter via the `auth` option. The
values that you can obtain from the
https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html[create api key endpoint].
NOTE: If you provide both basic authentication credentials and the Api Key configuration, the Api Key will take precedence.
[source,js]
----
const { Client } = require('@elastic/elasticsearch')