@@ -34,35 +34,28 @@ npm install @elastic/elasticsearch-serverless
3434
3535## Instantiate a client
3636
37- You can instantiate a client by running the following command :
37+ Initialize the client using your Serverless project URL and API key, both provided by Elastic :
3838
3939``` js
4040const { Client } = require (' @elastic/elasticsearch-serverless' )
4141const client = new Client ({
42- cloud : { id : ' <cloud-id> ' },
43- auth: { apiKey: ' base64EncodedKey ' }
42+ node : ' https:// ' , // serverless project URL
43+ auth: { apiKey: ' your_api_key ' }, // project API key
4444})
4545```
4646
47- You can find the Elasticsearch endpoint on the Cloud deployment management page.
48-
49- <DocImage url = " images/copy-endpoint.gif" alt = " Copy the endpoint for Elasticsearch" />
50-
51- You can create a new API Key under ** Stack Management** > ** Security** :
52-
53- <DocImage url = " images/setup-api-key.gif" alt = " Create and copy Apy Key" />
47+ To get API keys or the URL for a project, see <DocLink id = " serverlessElasticsearchGetStarted" />.
5448
5549## Using the API
5650
57- After you instantiate a client with your API key and Elasticsearch endpoint, you
58- can start ingesting documents into the Elasticsearch Service. You can use the
59- Bulk API for this. This API enables you to index, update, and delete several
60- documents in one request.
51+ After you've initialized the client, you can start ingesting documents.
52+ You can use the Bulk API for this.
53+ This API enables you to index, update, and delete several documents in one request.
6154
6255### Creating an index and ingesting documents
6356
6457You can call the ` bulk ` helper API with a list of documents and a handler for
65- what action to perform on each handler .
58+ what action to perform on each document .
6659
6760The following is an example of bulk indexing some classic books into the ` books `
6861index:
@@ -106,15 +99,14 @@ await client.get({
10699
107100### Searching
108101
109- Now that some data is available, you can search your documents using the
110- ** Search API** :
102+ Now that some data is available, you can search your documents using the ** Search API** :
111103
112104``` js
113105const result = await client .search ({
114106 index: ' books' ,
115107 query: {
116108 match: {
117- author: ' Ray Bradbury '
109+ author: ' ray bradbury '
118110 }
119111 }
120112})
0 commit comments