Skip to content

Commit f7d320e

Browse files
feat: Add warning that this package is deprecated (#105)
Co-authored-by: Josh Mock <[email protected]>
1 parent 8f77bc0 commit f7d320e

File tree

3 files changed

+5
-83
lines changed

3 files changed

+5
-83
lines changed

README.md

Lines changed: 2 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,3 @@
1-
<p align="center">
2-
<img src="https://github.com/elastic/elasticsearch-py/raw/main/docs/logo-elastic-glyph-color.svg" width="20%" alt="Elastic logo" />
3-
</p>
1+
# :warning: This package is deprecated
42

5-
# Elasticsearch Serverless Client
6-
7-
[![main](https://github.com/elastic/elasticsearch-serverless-js/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/elastic/elasticsearch-serverless-js/actions/workflows/tests.yml)
8-
9-
This is the official Node.js Elastic client for the [**Elasticsearch Cloud Serverless** service](https://www.elastic.co/elasticsearch/serverless).
10-
If you're looking to develop your Node.js application with the Elasticsearch Stack, you should look at the [Elasticsearch Client](https://github.com/elastic/elasticsearch-js) instead.
11-
If you're looking to develop your Node.js application with Elastic Enterprise Search, you should look at the [Enterprise Search Client](https://github.com/elastic/enterprise-search-js/).
12-
13-
## Installation
14-
15-
Install via npm:
16-
17-
```shell
18-
npm install @elastic/elasticsearch-serverless
19-
```
20-
21-
### Instantiate a Client
22-
23-
```javascript
24-
const { Client } = require('@elastic/elasticsearch-serverless')
25-
const client = new Client({
26-
node: 'https://', // serverless project URL
27-
auth: { apiKey: 'your_api_key' }, // project API key
28-
})
29-
```
30-
31-
### Using the API
32-
33-
Once you've instantiated a client with your API key and Elasticsearch endpoint, you can start ingesting documents into Elasticsearch Service.
34-
You can use the **Bulk API** for this.
35-
This API allows you to index, update and delete several documents in one request.
36-
You call the `bulk` API on the client with a body parameter, an Array of hashes that define the action and a document.
37-
Here's an example of indexing some classic books into the `books` index:
38-
39-
```javascript
40-
// First we build our data:
41-
const body = [
42-
{name: "Snow Crash", "author": "Neal Stephenson", "release_date": "1992-06-01", "page_count": 470},
43-
{name: "Revelation Space", "author": "Alastair Reynolds", "release_date": "2000-03-15", "page_count": 585},
44-
{name: "1984", "author": "George Orwell", "release_date": "1985-06-01", "page_count": 328},
45-
{name: "Fahrenheit 451", "author": "Ray Bradbury", "release_date": "1953-10-15", "page_count": 227},
46-
{name: "Brave New World", "author": "Aldous Huxley", "release_date": "1932-06-01", "page_count": 268},
47-
{name: "The Handmaid's Tale", "author": "Margaret Atwood", "release_date": "1985-06-01", "page_count": 311}
48-
]
49-
50-
// Then we send the data using the bulk API helper:
51-
const result = await client.helpers.bulk({
52-
datasource: body,
53-
onDocument (doc) {
54-
// instructs the bulk indexer to add each item in `body` to the books index
55-
// you can optionally inspect each `doc` object to alter what action is performed per document
56-
return {
57-
index: { _index: 'books' }
58-
}
59-
}
60-
})
61-
```
62-
63-
Now that some data is available, you can search your documents using the **Search API**:
64-
65-
```js
66-
const result = await client.search({
67-
index: 'books',
68-
query: {
69-
match: {
70-
author: 'Ray Bradbury'
71-
}
72-
}
73-
})
74-
console.log(result.hits.hits)
75-
```
76-
77-
## Development
78-
79-
See [CONTRIBUTING](./CONTRIBUTING.md).
80-
81-
### Docs
82-
83-
Some general notes about this project can be found in [the docs directory](./docs/).
3+
This package is deprecated and no longer being maintained. All Elasticsearch serverless functionality has been merged into the [`@elastic/elasticsearch` client](https://www.github.com/elastic/elasticsearch-js).

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@elastic/elasticsearch-serverless",
3-
"version": "0.9.0+20231031",
3+
"version": "0.9.1+20231031",
44
"description": "The official Node.js Elastic client for the Elasticsearch Serverless service.",
55
"main": "./index.js",
66
"types": "index.d.ts",

src/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ import API from './api'
4848
import packageJson from '../package.json'
4949
import transportPackageJson from '@elastic/transport/package.json'
5050

51+
console.warn('This package is deprecated and no longer being supported or maintained. All Elasticsearch serverless functionality has been merged back into @elastic/elasticsearch.')
52+
5153
const kChild = Symbol('elasticsearchjs-child')
5254
const kInitialOptions = Symbol('elasticsearchjs-initial-options')
5355
let clientVersion: string = packageJson.version

0 commit comments

Comments
 (0)