Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 8.12] Update changelog for 8.12.2 (#2139) * Backport changelog for 8.12.1 * Add changelog for 8.12.2 #2140

Closed
wants to merge 11 commits into from
Closed
4 changes: 3 additions & 1 deletion .buildkite/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ RUN apt-get clean -y && \

WORKDIR /usr/src/app

COPY . .
COPY package.json .
RUN npm install --production=false

COPY . .
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ steps:
env:
NODE_VERSION: "{{ matrix.nodejs }}"
TEST_SUITE: "{{ matrix.suite }}"
STACK_VERSION: 8.10.3-SNAPSHOT
STACK_VERSION: 8.12.0-SNAPSHOT
matrix:
setup:
suite:
Expand Down
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ npm-debug.log
test/benchmarks
elasticsearch
.git
lib
junit-output
27 changes: 27 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Package to npm
on:
workflow_dispatch:
inputs:
branch:
description: 'Git branch to build and publish'
required: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install -g npm
- run: npm install
- run: npm test
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 4 additions & 4 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ spec:
main_semi_daily:
branch: 'main'
cronline: '0 */12 * * *'
8_9_semi_daily:
branch: '8.9'
8_12_semi_daily:
branch: '8.12'
cronline: '0 */12 * * *'
8_8_daily:
branch: '8.8'
8_11_daily:
branch: '8.11'
cronline: '@daily'
89 changes: 89 additions & 0 deletions docs/advanced-config.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,95 @@ const client = new Client({
})
----

[discrete]
[[redaction]]
==== Redaction of potentially sensitive data

When the client raises an `Error` that originated at the HTTP layer, like a `ConnectionError` or `TimeoutError`, a `meta` object is often attached to the error object that includes metadata useful for debugging, like request and response information. Because this can include potentially sensitive data, like authentication secrets in an `Authorization` header, the client takes measures to redact common sources of sensitive data when this metadata is attached and serialized.

If your configuration requires extra headers or other configurations that may include sensitive data, you may want to adjust these settings to account for that.

By default, the `redaction` option is set to `{ type: 'replace' }`, which recursively searches for sensitive key names, case insensitive, and replaces their values with the string `[redacted]`.

[source,js]
----
const { Client } = require('@elastic/elasticsearch')

const client = new Client({
cloud: { id: '<cloud-id>' },
auth: { apiKey: 'base64EncodedKey' },
})

try {
await client.indices.create({ index: 'my_index' })
} catch (err) {
console.log(err.meta.meta.request.options.headers.authorization) // prints "[redacted]"
}
----

If you would like to redact additional properties, you can include additional key names to search and replace:

[source,js]
----
const { Client } = require('@elastic/elasticsearch')

const client = new Client({
cloud: { id: '<cloud-id>' },
auth: { apiKey: 'base64EncodedKey' },
headers: { 'X-My-Secret-Password': 'shhh it's a secret!' },
redaction: {
type: "replace",
additionalKeys: ["x-my-secret-password"]
}
})

try {
await client.indices.create({ index: 'my_index' })
} catch (err) {
console.log(err.meta.meta.request.options.headers['X-My-Secret-Password']) // prints "[redacted]"
}
----

Alternatively, if you know you're not going to use the metadata at all, setting the redaction type to `remove` will remove all optional sources of potentially sensitive data entirely, or replacing them with `null` for required properties.

[source,js]
----
const { Client } = require('@elastic/elasticsearch')

const client = new Client({
cloud: { id: '<cloud-id>' },
auth: { apiKey: 'base64EncodedKey' },
redaction: { type: "remove" }
})

try {
await client.indices.create({ index: 'my_index' })
} catch (err) {
console.log(err.meta.meta.request.options.headers) // undefined
}
----

Finally, if you prefer to turn off redaction altogether, perhaps while debugging on a local developer environment, you can set the redaction type to `off`. This will revert the client to pre-8.11.0 behavior, where basic redaction is only performed during common serialization methods like `console.log` and `JSON.stringify`.

WARNING: Setting `redaction.type` to `off` is not recommended in production environments.

[source,js]
----
const { Client } = require('@elastic/elasticsearch')

const client = new Client({
cloud: { id: '<cloud-id>' },
auth: { apiKey: 'base64EncodedKey' },
redaction: { type: "off" }
})

try {
await client.indices.create({ index: 'my_index' })
} catch (err) {
console.log(err.meta.meta.request.options.headers.authorization) // the actual header value will be logged
}
----

[discrete]
==== Migrate to v8

Expand Down
62 changes: 62 additions & 0 deletions docs/changelog.asciidoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,59 @@
[[changelog-client]]
== Release notes

[discrete]
=== 8.12.2

[discrete]
==== Fixes

[discrete]
===== Upgrade transport to 8.4.1 https://github.com/elastic/elasticsearch-js/pull/2137[#2137]

Upgrades `@elastic/transport` to 8.4.1 to resolve https://github.com/elastic/elastic-transport-js/pull/83[a bug] where arrays in error diagnostics were unintentionally transformed into objects.

[discrete]
=== 8.12.1

[discrete]
==== Fixes

[discrete]
===== Fix hang in bulk helper semaphore https://github.com/elastic/elasticsearch-js/pull/2027[#2027]

The failing state could be reached when a server's response times are slower than flushInterval.

[discrete]
=== 8.12.0

[discrete]
=== Features

[discrete]
===== Support for Elasticsearch `v8.12.0`

You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.12/release-notes-8.12.0.html[here].

[discrete]
=== 8.11.0

[discrete]
=== Features

[discrete]
===== Support for Elasticsearch `v8.11.0`

You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.11/release-notes-8.11.0.html[here].

[discrete]
===== Enhanced support for redacting potentially sensitive data https://github.com/elastic/elasticsearch-js/pull/2095[#2095]

`@elastic/transport` https://github.com/elastic/elastic-transport-js/releases/tag/v8.4.0[version 8.4.0] introduces enhanced measures for ensuring that request metadata attached to some `Error` objects is redacted. This functionality is primarily to address custom logging solutions that don't use common serialization methods like `JSON.stringify`, `console.log`, or `util.inspect`, which were already accounted for.

See <<redaction>> for more information.

[discrete]
=== 8.10.0

Expand Down Expand Up @@ -342,6 +395,9 @@ The client API leaks HTTP-related notions in many places, and removing them woul

This could be a rather big breaking change, so a double solution could be used during the 8.x lifecycle. (accepting body keys without them being wrapped in the body as well as the current solution).

To convert code from 7.x, you need to remove the `body` parameter in all the endpoints request.
For instance, this is an example for the `search` endpoint:

[source,js]
----
// from
Expand Down Expand Up @@ -380,6 +436,12 @@ If you weren't extending the internals of the client, this won't be a breaking c
The client API leaks HTTP-related notions in many places, and removing them would definitely improve the DX.
The client will expose a new request-specific option to still get the full response details.

The new behaviour returns the `body` value directly as response.
If you want to have the 7.x response format, you need to add `meta : true` in the request.
This will return all the HTTP meta information, including the `body`.

For instance, this is an example for the `search` endpoint:

[source,js]
----
// from
Expand Down
15 changes: 15 additions & 0 deletions docs/connecting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This page contains the information you need to connect and use the Client with
* <<client-connect-proxy, Connecting through a proxy>>
* <<client-error-handling, Handling errors>>
* <<keep-alive, Keep-alive connections>>
* <<close-connections, Closing a client's connections>>
* <<product-check, Automatic product check>>

[[authentication]]
Expand Down Expand Up @@ -691,6 +692,20 @@ const client = new Client({
})
----

[discrete]
[[close-connections]]
=== Closing a client's connections

If you would like to close all open connections being managed by an instance of the client, use the `close()` function:

[source,js]
----
const client = new Client({
node: 'http://localhost:9200'
});
client.close();
----

[discrete]
[[product-check]]
=== Automatic product check
Expand Down
12 changes: 12 additions & 0 deletions docs/doc_examples/36b86b97feedcf5632824eefc251d6ed.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[source,js]
----
const response = await client.search({
index: 'books',
query: {
match: {
name: 'brave'
}
}
})
console.log(response)
----
13 changes: 13 additions & 0 deletions docs/doc_examples/8575c966b004fb124c7afd6bb5827b50.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[source,js]
----
const response = await client.index({
index: 'books',
document: {
name: 'Snow Crash',
author: 'Neal Stephenson',
release_date: '1992-06-01',
page_count: 470,
}
})
console.log(response)
----
7 changes: 7 additions & 0 deletions docs/doc_examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[source,js]
----
const response = await client.search({
index: 'books'
})
console.log(response)
----
43 changes: 43 additions & 0 deletions docs/doc_examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[source,js]
----
const response = await client.bulk({
operations: [
{ index: { _index: 'books' } },
{
name: 'Revelation Space',
author: 'Alastair Reynolds',
release_date: '2000-03-15',
page_count: 585,
},
{ index: { _index: 'books' } },
{
name: '1984',
author: 'George Orwell',
release_date: '1985-06-01',
page_count: 328,
},
{ index: { _index: 'books' } },
{
name: 'Fahrenheit 451',
author: 'Ray Bradbury',
release_date: '1953-10-15',
page_count: 227,
},
{ index: { _index: 'books' } },
{
name: 'Brave New World',
author: 'Aldous Huxley',
release_date: '1932-06-01',
page_count: 268,
},
{ index: { _index: 'books' } },
{
name: 'The Handmaids Tale',
author: 'Margaret Atwood',
release_date: '1985-06-01',
page_count: 311,
}
]
})
console.log(response)
----
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@elastic/elasticsearch",
"version": "8.10.3",
"versionCanary": "8.10.3-canary.1",
"version": "8.12.0",
"versionCanary": "8.12.0-canary.0",
"description": "The official Elasticsearch client for Node.js",
"main": "index.js",
"types": "index.d.ts",
Expand Down Expand Up @@ -83,7 +83,7 @@
"zx": "^7.2.2"
},
"dependencies": {
"@elastic/transport": "^8.3.4",
"@elastic/transport": "^8.4.1",
"tslib": "^2.4.0"
},
"tap": {
Expand Down
Loading
Loading