Skip to content

Commit 7d00ef0

Browse files
leemthomporichkuz
andauthored
Merge pull request #33 from elastic/richkuz/example-app-search-auth (#34)
Example auth usage with private key Co-authored-by: Rich Kuzsma <[email protected]>
1 parent 44ca5e2 commit 7d00ef0

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

packages/enterprise-search/docs/app-search-api.asciidoc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ See <<quickstart-client>> for details on initializing the client.
3131
Note that App Search also has its own application-specific API keys and tokens.
3232
Refer to <<authentication>> for more information and relevant links.
3333

34+
Example of initializing the client using an App Search API private key for authorization.
35+
36+
[source,javascript]
37+
----
38+
const { Client } = require('@elastic/enterprise-search')
39+
const client = new Client({
40+
url: 'https://d84b2890a1d7f30699b04c7b1d6930f8.ent-search.europe-west1.gcp.cloud.es.io',
41+
auth: {
42+
token: 'private-abcdef17grbg9jg8m1zam9q'
43+
}
44+
})
45+
----
46+
47+
Once instantiated you can use the `client` object to make API requests to App Search.
48+
3449
[discrete#app-search-api-initializing-api-key]
3550
==== API key privileges
3651

@@ -1997,4 +2012,4 @@ async function run() {
19972012
}
19982013
19992014
run().catch(console.error)
2000-
----
2015+
----

0 commit comments

Comments
 (0)