From c3698702014a315f5a08e9e1b1753ed43ab2142a Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Mon, 24 Mar 2025 13:20:38 -0500 Subject: [PATCH 1/3] Add warning that this package is deprecated --- package.json | 2 +- src/client.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 3a183ca..b57b2c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@elastic/elasticsearch-serverless", - "version": "0.9.0+20231031", + "version": "0.9.1+20231031", "description": "The official Node.js Elastic client for the Elasticsearch Serverless service.", "main": "./index.js", "types": "index.d.ts", diff --git a/src/client.ts b/src/client.ts index 19e8988..488760a 100644 --- a/src/client.ts +++ b/src/client.ts @@ -48,6 +48,8 @@ import API from './api' import packageJson from '../package.json' import transportPackageJson from '@elastic/transport/package.json' +console.warn(`This package is deprecated and no longer supported. All serverless-specific Elasticsearch functionality has been merged back into @elastic/elasticsearch.`) + const kChild = Symbol('elasticsearchjs-child') const kInitialOptions = Symbol('elasticsearchjs-initial-options') let clientVersion: string = packageJson.version From 3b6eb2f8d3fa0032fc1cc304c28f88a022234320 Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Thu, 27 Mar 2025 09:32:27 -0500 Subject: [PATCH 2/3] Update README and some wording --- README.md | 84 ++------------------------------------------------- src/client.ts | 2 +- 2 files changed, 3 insertions(+), 83 deletions(-) diff --git a/README.md b/README.md index 5aa75ea..35346c5 100644 --- a/README.md +++ b/README.md @@ -1,83 +1,3 @@ -

- Elastic logo -

+# :warning: This package is deprecated -# Elasticsearch Serverless Client - -[![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) - -This is the official Node.js Elastic client for the [**Elasticsearch Cloud Serverless** service](https://www.elastic.co/elasticsearch/serverless). -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. -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/). - -## Installation - -Install via npm: - -```shell -npm install @elastic/elasticsearch-serverless -``` - -### Instantiate a Client - -```javascript -const { Client } = require('@elastic/elasticsearch-serverless') -const client = new Client({ - node: 'https://', // serverless project URL - auth: { apiKey: 'your_api_key' }, // project API key -}) -``` - -### Using the API - -Once you've instantiated a client with your API key and Elasticsearch endpoint, you can start ingesting documents into Elasticsearch Service. -You can use the **Bulk API** for this. -This API allows you to index, update and delete several documents in one request. -You call the `bulk` API on the client with a body parameter, an Array of hashes that define the action and a document. -Here's an example of indexing some classic books into the `books` index: - -```javascript -// First we build our data: -const body = [ - {name: "Snow Crash", "author": "Neal Stephenson", "release_date": "1992-06-01", "page_count": 470}, - {name: "Revelation Space", "author": "Alastair Reynolds", "release_date": "2000-03-15", "page_count": 585}, - {name: "1984", "author": "George Orwell", "release_date": "1985-06-01", "page_count": 328}, - {name: "Fahrenheit 451", "author": "Ray Bradbury", "release_date": "1953-10-15", "page_count": 227}, - {name: "Brave New World", "author": "Aldous Huxley", "release_date": "1932-06-01", "page_count": 268}, - {name: "The Handmaid's Tale", "author": "Margaret Atwood", "release_date": "1985-06-01", "page_count": 311} -] - -// Then we send the data using the bulk API helper: -const result = await client.helpers.bulk({ - datasource: body, - onDocument (doc) { - // instructs the bulk indexer to add each item in `body` to the books index - // you can optionally inspect each `doc` object to alter what action is performed per document - return { - index: { _index: 'books' } - } - } -}) -``` - -Now that some data is available, you can search your documents using the **Search API**: - -```js -const result = await client.search({ - index: 'books', - query: { - match: { - author: 'Ray Bradbury' - } - } -}) -console.log(result.hits.hits) -``` - -## Development - -See [CONTRIBUTING](./CONTRIBUTING.md). - -### Docs - -Some general notes about this project can be found in [the docs directory](./docs/). +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). diff --git a/src/client.ts b/src/client.ts index 488760a..ee85170 100644 --- a/src/client.ts +++ b/src/client.ts @@ -48,7 +48,7 @@ import API from './api' import packageJson from '../package.json' import transportPackageJson from '@elastic/transport/package.json' -console.warn(`This package is deprecated and no longer supported. All serverless-specific Elasticsearch functionality has been merged back into @elastic/elasticsearch.`) +console.warn(`This package is deprecated and no longer being supported or maintained. All Elasticsearch serverless functionality has been merged back into @elastic/elasticsearch.`) const kChild = Symbol('elasticsearchjs-child') const kInitialOptions = Symbol('elasticsearchjs-initial-options') From 9573f77a5bddf6ecb7934f03250498fc5f0562ed Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Tue, 8 Apr 2025 11:49:22 -0500 Subject: [PATCH 3/3] Appease the linter --- src/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index ee85170..2b4dbb9 100644 --- a/src/client.ts +++ b/src/client.ts @@ -48,7 +48,7 @@ import API from './api' import packageJson from '../package.json' import transportPackageJson from '@elastic/transport/package.json' -console.warn(`This package is deprecated and no longer being supported or maintained. All Elasticsearch serverless functionality has been merged back into @elastic/elasticsearch.`) +console.warn('This package is deprecated and no longer being supported or maintained. All Elasticsearch serverless functionality has been merged back into @elastic/elasticsearch.') const kChild = Symbol('elasticsearchjs-child') const kInitialOptions = Symbol('elasticsearchjs-initial-options')