Compare commits

...

9 Commits

Author SHA1 Message Date
8a57dc0402 [Backport 8.3] Use correct user-agent header by default (#1874)
Co-authored-by: Josh Mock <josh@joshmock.com>
2023-05-05 11:19:42 -05:00
cac4203919 [8.3] [DOCS] Includes source_branch in docs index 2023-02-22 07:47:34 -06:00
9c79ab320c Update bulk.asciidoc (#1752)
Fix typo
2023-01-12 14:22:38 +01:00
397422d108 Remove unnecessary ts-expect-error
Co-authored-by: Seth Michael Larson <seth.larson@elastic.co>
2022-09-27 07:52:10 -05:00
4a08881ec3 Fix docs URLs to use '8.3' instead of 'master' 2022-09-27 06:40:02 -05:00
4c281e0f78 Bumps to version 8.3.3 2022-07-07 11:31:50 -05:00
68f9476f11 [8.3] Change 'current' to 'master' in user profile API links
Co-authored-by: David Kilfoyle <41695641+kilfoyle@users.noreply.github.com>
2022-06-24 17:00:45 -05:00
92028f8208 Fix typo in changelog
Fixes a typo: `storngly` -> `strongly`

Co-authored-by: Christiane (Tina) Heiligers <christiane.heiligers@elastic.co>
2022-06-21 15:49:40 -05:00
4d190bc19a [Backport 8.3] Changelog for 8.2.1 (#1705)
Co-authored-by: Tomas Della Vedova <delvedor@users.noreply.github.com>
2022-05-25 18:16:27 +02:00
10 changed files with 269 additions and 228 deletions

View File

@ -1,6 +1,6 @@
---
STACK_VERSION:
- "8.3.0-SNAPSHOT"
- "8.3.3-SNAPSHOT"
NODE_JS_VERSION:
- 18

View File

@ -1,6 +1,35 @@
[[changelog-client]]
== Release notes
[discrete]
=== 8.2.1
[discrete]
==== Fixes
[discrete]
===== Support for Elasticsearch `v8.2.1`
You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.2/release-notes-8.2.1.html[here].
[discrete]
===== Fix ndjson APIs https://github.com/elastic/elasticsearch-js/pull/1688[#1688]
The previous release contained a bug that broken ndjson APIs.
We have released `v8.2.0-patch.1` to address this.
This fix is the same as the one we have released and we strongly recommend upgrading to this version.
[discrete]
===== Fix node shutdown apis https://github.com/elastic/elasticsearch-js/pull/1697[#1697]
The shutdown APIs wheren't complete, this fix completes them.
[discrete]
==== Types: move query keys to body https://github.com/elastic/elasticsearch-js/pull/1693[#1693]
The types definitions where wrongly representing the types of fields present in both query and body.
[discrete]
=== 8.2.0

View File

@ -77,8 +77,8 @@ async function run () {
// fix the document before to try it again.
status: action[operation].status,
error: action[operation].error,
operation: body[i * 2],
document: body[i * 2 + 1]
operation: operations[i * 2],
document: operations[i * 2 + 1]
})
}
})

View File

@ -1,6 +1,6 @@
= Elasticsearch JavaScript Client
:branch: master
include::{asciidoc-dir}/../../shared/versions/stack/{source_branch}.asciidoc[]
include::{asciidoc-dir}/../../shared/attributes.asciidoc[]
include::introduction.asciidoc[]

View File

@ -377,9 +377,9 @@ child.search({
To improve observability, the client offers an easy way to configure the
`X-Opaque-Id` header. If you set the `X-Opaque-Id` in a specific request, this
allows you to discover this identifier in the
https://www.elastic.co/guide/en/elasticsearch/reference/master/logging.html#deprecation-logging[deprecation logs],
helps you with https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-slowlog.html#_identifying_search_slow_log_origin[identifying search slow log origin]
as well as https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html#_identifying_running_tasks[identifying running tasks].
https://www.elastic.co/guide/en/elasticsearch/reference/8.3/logging.html#deprecation-logging[deprecation logs],
helps you with https://www.elastic.co/guide/en/elasticsearch/reference/8.3/index-modules-slowlog.html#_identifying_search_slow_log_origin[identifying search slow log origin]
as well as https://www.elastic.co/guide/en/elasticsearch/reference/8.3/tasks.html#_identifying_running_tasks[identifying running tasks].
The `X-Opaque-Id` should be configured in each request, for doing that you can
use the `opaqueId` option, as you can see in the following example. The

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"name": "@elastic/elasticsearch",
"version": "8.3.0",
"versionCanary": "8.3.0-canary.1",
"version": "8.3.3",
"versionCanary": "8.3.3-canary.0",
"description": "The official Elasticsearch client for Node.js",
"main": "index.js",
"types": "index.d.ts",
@ -91,4 +91,4 @@
"coverage": false,
"check-coverage": false
}
}
}

View File

@ -20,6 +20,7 @@
import { ConnectionOptions as TlsConnectionOptions } from 'tls'
import { URL } from 'url'
import buffer from 'buffer'
import os from 'os'
import {
Transport,
UndiciConnection,
@ -173,7 +174,9 @@ export default class Client extends API {
tls: null,
caFingerprint: null,
agent: null,
headers: {},
headers: {
'user-agent': `elasticsearch-js/${clientVersion} Node.js ${nodeVersion}; Transport ${transportVersion}; (${os.platform()} ${os.release()} ${os.arch()})`
},
nodeFilter: null,
generateRequestId: null,
name: 'elasticsearch-js',

View File

@ -19,6 +19,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
/* eslint-disable @typescript-eslint/promise-function-async */
/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
import assert from 'assert'
import { promisify } from 'util'
@ -228,7 +229,6 @@ export default class Helpers {
rest_total_hits_as_int: params.rest_total_hits_as_int,
scroll_id
}, options as TransportRequestOptionsWithMeta)
// @ts-expect-error
response = r as TransportResult<T.ScrollResponse<TDocument, TAggregations>, unknown>
assert(response !== undefined, 'The response is undefined, please file a bug report')
if (response.statusCode !== 429) break

View File

@ -432,3 +432,12 @@ test('caFingerprint can\'t be configured over http / 2', t => {
)
t.end()
})
test('user agent is in the correct format', t => {
const client = new Client({ node: 'http://localhost:9200' })
const agentRaw = client.transport[symbols.kHeaders]['user-agent'] || ''
const agentSplit = agentRaw.split(/\s+/)
t.equal(agentSplit[0].split('/')[0], 'elasticsearch-js')
t.ok(/^\d+\.\d+\.\d+/.test(agentSplit[0].split('/')[1]))
t.end()
})